Now, it's all under the notebook umbrella. Seems to be appropriate as it is just my notes after all. I also updated some notes from there. I didn't keep track of what it is this time. Something about more learning notes extracted from my "Learning how to learn" course notes and then some. Lack of time and hurriness just makes it difficult to track but it should be under version control already.
2.2 KiB
Command line: FFmpeg
The swiss army knife for interacting with multimedia files (except images because ImageMagick).
Options
The FFmpeg command line interface is mostly picky because of order. Whatever options are given will be processed with those options in order.
-hide_banner
- hide the annoying banner-loglevel [level] | -v [level]
- set the verbosity level-codecs
- list all codecs-devices
- list all devices-i [file]
- the input filec [codec]
- set the codec-b [rate]
- set the bitrate-o [file]
- set the output
Certain options have the option of specifying whether you're interacting with the audio or video track.
For example, -codec:audio
(-c:a
) to set the audio codec.
Examples
FFmpeg is comprehensive and so needs some specific examples to fill my monkey brain.
Convert an MP3 to OGG
ffmpeg -i $INPUT.mp3 -o $OUTPUT.ogg
By default, FFmpeg will guess if certain things are missing. In this case, it guessed the input file is an MP3 and wants to convert OGG. Sometimes, it will also use default options for converting between two formats such as the default bitrate and codec.
Transrate an audio file
ffmpeg -i $INPUT -c $CODE -b:a $BITRATE $OUTPUT
List all available options
FFmpeg has compile options, heaps of them. You may want to know what codecs are available.
ffmpeg -codecs
It tends to be a large list so prepare to send it through a pager.
You should also know FFmpeg can print out devices.
ffmpeg -devices
Capture video device
# Assuming /dev/video0 is your webcam.
ffmpeg -f video4linux2 -i /dev/video0 cringe-at-yourself.mpg
Extract a segment from a file
The timestamps are essentially seeking to a file. For more information, see FFmpeg documentation.
ffmpeg -nostdin -i $INPUT -ss 00:05:22 -to 00:22:43 $OUTPUT