Interception of 10 s

ffmpeg -i in.mp4-ss 00:01:00 -to 00:01:10 -acodec copy out.mp4
ffmpeg -i in.mp4 -ss 00:01:00 -t 10 -acodec copy out.mp4 Copy the code

10 to 20 seconds into a GIF

ffmpeg -i in.mp4 -ss 10 -to 20 -s 640x320 -r 15 out.gif Copy the code

Merge files

ffmpeg -i "concat:01.mp4|02.mp4|03.mp4" -c copy out.mp4 Copy the code

Watermark the upper left corner

ffmpeg -i in.mp4 -i logo.png -filter_complex overlay out.mp4 Copy the code

Modify the frame rate

ffmpeg -i in.mp4 -r 30 out.mp4 Copy the code

Modify the video bit rate

ffmpeg -i in.mp4 -b:v 600K out.mp4Copy the code

Video encoding format conversion

ffmpeg -i in.mp4 -vcodec h264 out.mp4Copy the code

Control output file size ((video bit rate + audio bit rate) * Duration /8 = file size K)

ffmpeg -i in.mp4 -fs 10M out.mp4
Copy the code

Video format conversion

ffmpeg -i in.mp4 out.ts
Copy the code

Extract audio

ffmpeg -i in.mp4 -acodec copy -vn out.aac
ffmpeg -i in.mp4 -acodec aac -vn out.aacCopy the code

Extraction of video

ffmpeg -i in.mp4 -vcodec copy -an out.mp4Copy the code

Zoom out to 960×540 output

ffmpeg -i in.mp4 -vf scale=960:540 out.mp4Copy the code

Main parameters:

-i Sets the input stream

-f Sets the output format

-ss Indicates the start time

Video parameters:

-b sets the video traffic rate (bit rate). The default value is 200Kbit/s

-r Sets the frame rate. The default is 25

-s Sets the width and height of the screen

– Aspect Sets the scale of the picture

– VN does not process videos

-vcodec Sets the video codec. If it is not set, the same codec is used as the input stream

Audio parameters:

-ar Sets the sampling rate

– AC Sets the number of sound channels

-acodec Sets the sound codec, or if not, uses the same codec as the input stream

-an does not process audio