ffmpeg basic
2018-11-26
Tech
411
Input and Output
$ ffmpeg -i input.mp4 output.mp4
Cutting Video or Audio
Begin and length:
$ ffmpeg -i input.mp4 -ss 00:00:10 -t 01:00:10 output.mp4
Beginning time and ending time:
$ ffmpeg -i input.mp4 -ss 01:00 -to 10:00 -c copy output.mp4
"-c" is short for "-codec". Use "-codec:a" or "-codec:v" to specify audio or viedo respectively.
"-c copy" suggests that the data will be copy directly to output (rather than being converted in some cases).
Video Converting
$ ffmpeg -i input1.flv input2.flv -framerate 30 -f mp4 -vf "scale=1280x720" output.mp4
$ ffmpeg -i input1.flv input2.flv -framerate 30 -f mp4 -vf "crop=${w}:${h}:${x}:${y}" output.mp4
"-framerate 30" fixes the framerate to 30 fps.
"-f mp4" before