
Last updated on
useful ffmpeg snippets
Extract video section
ffmpeg -i input.MP4 -ss 0030 -to 0042 -c copy output.mp4
Meaning
-i
: select input file-ss
: start second-to
: end second-c copy
copy all streams as original (audio, video, subs)- end with file name of final file
Remove audio from clip
ffmpeg -i input.mp4 -an -c copy output.mp4
Meaning
-i
: select input file-an
: remove audio stream-c copy
: copy every other stream as original- end with file name of final file
Concat two clips
Create concat.txt
file with input files
file 'input-1.mp4'
file 'input-2.mp4'
and then run
ffmpeg -f concat -i concat.txt -c copy output.mp4
Meaning
-f concat
: use concat ffmpeg function-i
: select input file-c copy
copy all streams as original (audio, video, subs)- end with file name of final file
Extract single frames from clip
ffmpeg -i input.mp4 -qscale:v 1 -r 1/60 -frames:v 3 output_%03d.jpg
Meaning
-i
: select input file-qscale:v
: output quality (1: max quality - 31: lowest quality)-r
: number of frame output per second-frames:v
: maximum number of frames to output%03d
: automatically generate the name of output files
Changelog
- : Add single frame generation