From Schmid.wiki
Jump to: navigation, search

Get file info:

   ffprobe INPUTFILE

Encode with crop filter for YouTube:

   ffmpeg -i INPUTFILE -acodec copy
          -filter:v "crop=WIDTH:HEIGHT:XOFF:YOFF"
          -c:v libx264 -preset slow -crf 18 -y OUTPUTFILE

Extract audio:

   ffmpeg -i INPUTFILE -vn OUTPUT.wav              # convert to wav
   ffmpeg -i INPUTFILE -vn -acodec copy OUTPUTFILE # dump raw audio data

Highpass filter audio (useful for DC removal from emulator recordings):

   # Highpass 10 Hz, 12dB/octave
   ffmpeg -i INPUTFILE -vcodec copy -filter_complex "highpass=f=10" OUTPUTFILE

Create a lossless compressed h264 video (-crf 0 means uncompressed):

   ffmpeg -i INPUTFILE -crf 0 -preset veryslow OUTPUT.mp4

Get audio gain info:

   ffmpeg -i INPUTFILE -af volumedetect -f null /dev/null # *nix
   ffmpeg -i INPUTFILE -af volumedetect -f null NUL # Windows
   ...
   mean_volume: -48.8 dB
   max_volume: -25.3 dB
   ...

Adjust volume:

   ffmpeg -i INPUTFILE -vcodec copy -af volume=0.3 OUTPUTFILE
   ffmpeg -i INPUTFILE -vcodec copy -af volume=25dB OUTPUTFILE

Trim:

   # first 30s
   ffmpeg -i INPUTFILE -ss 00:00:00.000 -t 00:00:30.000 -vcodec copy -acodec copy -y OUTPUTFILE
   # from 10s to 20s (note that -t sets the duration of the video, not an offset)
   ffmpeg -i INPUTFILE -ss 00:00:10.000 -t 00:00:10.000 -vcodec copy -acodec copy -y OUTPUTFILE

MAME

Record video from MAME, output file is in 'snap':

   mame defender -aviwrite test.avi
   ffmpeg -i snap\test.avi -crf 0 -preset veryslow test.mp4