Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#5854 closed defect (invalid)

H.264 encoding - veryfast preset produces smaller file than faster preset

Reported by: mimac Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
According to https://trac.ffmpeg.org/wiki/Encode/H.264, for constant quality encoding, faster preset should be slower and produce smaller file than veryfast preset. However, by my testing, faster preset produced always bigger file than veryfast preset.

How to reproduce:

ffmpeg version N-81696-gd38dff8e-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.1 (Debian 5.4.1-2) 20160904
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --enable-libzimg --cc=gcc-5
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 57.100 / 57. 57.100
  libavformat    57. 49.100 / 57. 49.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 62.100 /  6. 62.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100


% ffmpeg  -i newmobcal1920_12mbps.ts  -c:v libx264 -profile:v high -level 4.0 -preset faster result-faster.mkv
% ffmpeg  -i newmobcal1920_12mbps.ts  -c:v libx264 -profile:v high -level 4.0 -preset veryfast result-veryfast.mkv
% ll *.mkv
-rw-rw-r-- 1 user user 84785654 Sep 19 21:28 result-faster.mkv
-rw-rw-r-- 1 user user 77822551 Sep 19 21:15 result-veryfast.mkv

Input video is from http://www.w6rz.net (http://www.w6rz.net/newmobcal1920_12mbps.ts). Reports are attached.

I was able to reproduce this behavior on Ubuntu as well as Windows, with three different input files (H.264, MPEG2, MJPEG), also with CFR values 18, 23 and 28. Veryfast preset always produced smaller file than faster and fast preset, in most cases also smaller than medium preset.

Attachments (2)

ffmpeg-20160919-213026-faster.log (884.8 KB) - added by mimac 2 years ago.
Report for faster preset
ffmpeg-20160919-215236-veryfast.log (853.5 KB) - added by mimac 2 years ago.
Report for veryfast preset

Download all attachments as: .zip

Change History (6)

Changed 2 years ago by mimac

Report for faster preset

Changed 2 years ago by mimac

Report for veryfast preset

comment:1 Changed 2 years ago by mimac

  • Version changed from unspecified to git-master

comment:2 Changed 2 years ago by heleppkes

  • Resolution set to invalid
  • Status changed from new to closed

First and foremost, these are libx264 presets and not something FFmpeg manages. As such, any questions to how libx264 compression works should be directed to that project.

To the issue at hand, there are no size guarantees for any of the presets, only speed/quality tradeoffs. It is very well possible that faster presets produce smaller files, albeit at a lower quality.

comment:3 Changed 2 years ago by mimac

I will direct the question to libx264 project, sorry for misunderstanding.
For the size guarantees, I made tests with constant quality settings and thought that results would comply with what page about encoding states:
Similarly, for constant quality encoding, you will simply save bitrate by choosing a slower preset.

comment:4 Changed 2 years ago by cehoyos

  • Keywords H.264 preset removed
Note: See TracTickets for help on using tickets.