#+title: FFmpeg
#+date: "2021-05-09 16:40:50 +08:00"
#+date_modified: "2021-05-09 17:13:35 +08:00"
#+language: en


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 file
- ~c [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

#+begin_src shell
ffmpeg -i $INPUT.mp3 -o $OUTPUT.ogg
#+end_src

By default, FFmpeg will guess if certain things are missing.
In this case, it guessed you want to convert the


** Transrate an audio file

#+begin_src shell
ffmpeg -i $INPUT -c $CODE -b:a $BITRATE $OUTPUT
#+end_src
