FFMpeg Options
Global Options
AVOptions
These options are specific to the given container, device or codec. The '-profile' option above is an example of such an option. These options are provided directly to the libavformat, libavdevice, and libavcodec libraries.
Main Options
'-fmt (input/output)'
FFMpeg normally auto detects the file format for input or output files, guessed from the file extension so often it is not required to specify the format. The format can be explicitly specified by using '-fmt', for input or output files.
'-y (global)'
If the output file(s) already exist, FFMpeg will halt and present the user with the option to overwrite the file. Specifying '-y' overwrites output files without user intervention.
'-t duration (input/output)'
This argument applies both to input and output files. If specifying a duration as an input option (before -i), the result is limiting the duration of the data read from the input file. When specified as an output option (before the output filename) the FFMpeg will stop writing after its reached the specified duration.
Specifying '-t 20' as an input file, with two output files will result in decoding and re-encoding the 1st 20 seconds of video creating two equivalent output files:
$ ffmpeg -y -t 20 -i big_buck_bunny_1080p_h264.mov -an /tmp/foo1.mov -an /tmp/foo2.mov
Repeating the command while specifying '-t 10' as an output argument to one of the files will result in one input file being 20 sec duration, the other a 10 second duration.
$ ffmpeg -y -t 20 -i big_buck_bunny_1080p_h264.mov -an /tmp/foo1.mov -an -t 10 /tmp/foo2.mov
'-fs fileSize (input/output)'
$ ffmpeg -y -i big_buck_bunny_1080p_h264.mov -an -fs 10M /tmp/foo-10M.mov
$ ls -lh /tmp/foo-10M.mov
-rw-rw-r-- 1 user user 9.8M Sep 5 17:45 /tmp/foo-10M.mov
But what if you want to fast forward to 30 seconds into the input file followed by encoding the following 10 seconds? The '-ss' fits the bill when specified as an input file option. When specified as an output file option, the end result is similar, accomplished by decoding but discarding the input until the timestamps position is reached.
$ ffmpeg -y -ss 30 -i big_buck_bunny_1080p_h264.mov -t 10 -an /tmp/foo-30-40.mov
Setting the timestamp