[] FFMPEG command

1. Background

Objective: FFMPEG simple commands application, we use better ideas, to guide the reader to explore the learning
system versions: UBUNTU 18.04.03
player: VLC or FFPLAY

2. Online install FFMPEG

apt  install  ffmpeg

3. Command demonstration

ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

3.1. Simple input and output

Convert msatartup.mp3 file 3.mp3

ffmpeg -i /usr/local/nginx/html/mscore/av/msatartup.mp3 3.mp3

3.2. Control by frame rate conversion

Convert msatartup.mp3 file 3.mp3, the conversion rate was significantly slower. But during the real-time flow control, easy to use, otherwise the maximum speed will be converted;

ffmpeg -re  -i /usr/local/nginx/html/mscore/av/msatartup.mp3 3.mp3

3.3. Plug-flow encapsulation format specified

Convert msatartup.mp3 file udp stream mpegts format. At this point need to add parameters -f mpegts, specify the output format mpegts (Why not add it before? FFMPEG will automatically detect the original, before 3.mp3, it is easy to determine the output package as mp3). In addition, you can test, use -re and the actual results of the comparison results do not use.

	使用ffmpeg  -muxers可以查看可用的muxer;
ffmpeg -re  -i /usr/local/nginx/html/mscore/av/msatartup.mp3 -f mpegts  udp://127.0.0.1:5000

3.4. Processing the input file specified number of times

Msatartup.mp3 still convert files to udp stream mpegts format, if you find that every moment, converted automatically stopped? Let him plug flow in accordance with the number of times we set, how to do it? -Stream_loop option to use, how many times you need to loop fill in how many times. If you need an infinite loop it? Use -1

ffmpeg  -stream_loop  -1 -re  -i /usr/local/nginx/html/mscore/av/msatartup.mp3 -f mpegts  udp://127.0.0.1:5000

3.4 audio and video format encoding process

One might ask? I need a unified mp3 audio coding how to do? Use -c: a mp3, empathy video encoding format -c: v h264 (but worth noting, as specified encoding format, FFMPEG will decode the audio and video re-encoding, it will lead to lower quality audio and video coding) .
Some people say that I do not want to lower my audio and video quality, I did not ask for encoding formats, how to do? I like people who did not ask to use -c copy all specified flow, -c: v copy specified constant video encoding format, -c: a copy audio encoding format specified unchanged;

Use ffmpeg -encoders can view the available encoders;

ffmpeg  -stream_loop  -1 -re  -i /usr/local/nginx/html/mscore/av/msatartup.mp3 -c:v copy -c:a mp3 -f mpegts  udp://127.0.0.1:5000
发布了92 篇原创文章 · 获赞 28 · 访问量 15万+

Guess you like

Origin blog.csdn.net/weixin_35804181/article/details/104069929