Days of Bike and Photos

Comparison of ffmpeg’s x264 presets

Measured performance of ffmpeg’s x264 quality presets, to know which option is the best for my purpose converting mpeg2 ts to Apple TV mp4. Factors need to be considered are 1) conversion speed, 2) file size and 3) quality of the video. The most important factor is conversion speed, which would be niceĀ if the time for conversion is shorter than for recording. For file size off course, the smaller the better as the space of my Apple TV storage is limited.

Test Method

The test was done with ffmpeg version 0.6.1 on 2.8GHz Intel Core i7 running Mac OS X 10.6.8 as;

for i in ultrafast superfast veryfast faster fast medium slow slower veryslow placebo
do ffmpeg -i sample.ts -threads 4 -vcodec libx264 \
      -vpre $i -vpre main -crf 18 -s 1280x720 \
      -acodec libfaac -ab 160k \
      -y $i.mp4

sample.ts is a 60 seconds of full HD (1440×1080) mpeg2 video.

Test Results

preset used for conversionConversion speed (fps - frames per second) Size of the output video file (in bytes)

On my environment, ultrafast can convert ts video almost at the recording speed (29.97 fps). But my decision was to go with superfast as its fps is closer to ultrafast yet the size is much smaller.

June 25, 2011 at 11:03 pm Comments (3)

Convert bi-lingual SD video for Apple TV

Followings are the points;

  • -newaudio to add another track
  • -alang to specify audio language
tssplitter_lite input.ts /dev/stdout 304 | \
  ffmpeg -i - -ss 1 -threads 2 \
    -vcodec libx264 -vpre fast -vpre main -crf 18 \
    -s 720x480 -r 30000/1001 -aspect 4:3 -vsync 1 -level 31 \
    -acodec libfaac -ab 130k -async 10 -ac 2 -alang jpn \
    -map 0.0 -map 0.1 -map 0.2 \
    -y ~/tmp/output.mp4 \
    -acodec libfaac -ab 130k -async 10 -ac 2 -alang eng -newaudio

June 19, 2011 at 2:36 am Comments (5)