Getting Started

brew install ffmpeg

Conversion between filetypes

  • Convert input.mp3 to output.aiff

    ffmpeg -i input.mp3 output.aiff

Making GIFs

  • Convert a video file input.mp4 into output.gif

    ffmpeg -i input.mp4 output.gif

Useful Arguments

  • -f <format>: Forcibly specify the input/output format, (usually set automatically)
  • -y: Automatically overwrite files without asking
  • -i <ifile>: Specify an input filename
  • -loglevel panic: Reduce the verbosity of ffmpeg (in this case, silence it)
  • -activation_bytes <hash>: The hexadecimal activation bytes used to decrypt Audible’s DRM

Examples of flag usage

  • Override the file without asking with -y

    ffmpeg -i 'input.mp4' -y 'exists.mp4'

Merging audio files

  • Merge all files ending with .mp3 into a single file named merged.mp3
ls *.mp3 | sort | sed 's/^/file /g' > 'files.txt'
ffmpeg -f 'concat' -i 'files.txt' -c copy 'merged.mp3'

Convert .aax files to .m4a

Assuming you know the activation bytes of your file…

  • Convert the audiobook input.aax to output.m4b

    ffmpeg -activation_bytes 123abc -i input.aax -c copy output.m4b

Extract cover art from a media file

  • Create file cover_art.jpg from the audio file input.m4b

    ffmpeg -i 'input.m4b' -map 0:v -map -0:V -c copy 'cover_art.jpg'