Skip to content

Instantly share code, notes, and snippets.

@nickstenning
Created December 4, 2011 13:48
Show Gist options
  • Save nickstenning/1430240 to your computer and use it in GitHub Desktop.
Save nickstenning/1430240 to your computer and use it in GitHub Desktop.
FFmpeg Transcoding Help
#
# no b-frames -- keep the profile simple!
# no cabac arithimetic coding. (corresponds to specs for level 1.3 video)
# for ipod video, make sure max avg bitrate doesn't go over 768
# http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2006-June/003218.html
#
# adapted from http://blog.archive.org/2011/06/04/improved-h-264-derivatives/
profile=baseline
coder=0
bf=0
refs=1
flags2=-wpred-dct8x8
level=30
b=700000
maxrate=768000
bufsize=1400000
wpredp=0
threads=2
# You'll need:
# 1) qtfaststart (pip install qtfaststart should "just work" if you're a pythonhead)
# 2) the ffmpeg preset file given with this gist
# Set scale options and -r (framerate) appropriately for your video
ffmpeg -deinterlace -y -i <INPUT_FILE> -vcodec libx264 -fpre libx264-IA.ffpreset -vf scale=640:480 -r 20 -map_meta_data -1:0 -pass 1 -an output_file.tmp.mp4
ffmpeg -deinterlace -y -i <INPUT_FILE> -vcodec libx264 -fpre libx264-IA.ffpreset -vf scale=640:480 -r 20 -map_meta_data -1:0 -pass 2 -acodec aac -strict experimental -ab 128k -ac 2 -ar 44100 output_file.tmp.mp4
qtfaststart output_file.tmp.mp4 output_file.mp4
# Set -s (size) and -r (framerate) appropriately for your video
ffmpeg -i <INPUT_FILE> -s svga -sameq -f ogg -acodec libvorbis -r 20 output_file.ogv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment