ffmpeg
Setup ffmpeg
Install¶
Ubuntu¶
sudo apt install ffmpeg
Windows¶
choco install ffmpeg
Usage¶
Simple stream copy¶
To rebuild "99.9% complete" videos without re-encoding.
ffmpeg -i input.mkv -c copy -o output.mkv
Remove audio without reencoding video¶
ffmpeg -i in.mp4 -vcodec copy -an out.mp4
ffmpeg -i input-video.avi -vn -acodec copy output-audio.aac
Options explained:
-vn
: no video output.-an
: no audio output.-{a,v}codec copy
: copy without re-encoding.
Cutting videos¶
Without re-encoding, just simple copying as-is:
ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy output.mp4
With re-encoding, slower but more frame accurate:
ffmpeg -i input.mp4 -ss 00:00:03 -t 00:00:08 -async 1 output.mp4
Options explained:
- -ss
for starting time hh::mm::ss
- -t
for duration of hh::mm::ss
, or -to
for end time hh::mm::ss