[Libav-user] qmin qmax settings for libx265 (HEVC) not functional

Taha Ansari mtaha.ansari at gmail.com
Thu Jun 5 07:37:25 CEST 2014


Hi,

First some background - I can use following command:

ffmpeg -i temp.mp4 -c:v libx264 -qmin 40 -qmax 51 -y output.mp4

to generate output.mp4 file in H264 format; with variance in qmin and qmax
parameters; the output is as expected: with different values of qmin/qmax,
resultant output file is of different size 'and' quality.

So we apply same principle to libx265, using this command line:

ffmpeg -i temp.mp4 -c:v libx265 -qmin 40 -qmax 41 -y output.mp4

we can see there is no complaining about any wrong parameters, but what's
observed is: no matter what value we select for qmin/qmax, resultant output
quality 'and' size are always the same.

Does anyone know why? Are these settings currently not supported or do we
need to add more parameters in command line to make it work?

Just for reference, here is output for "ffmpeg -i temp.mp4 -c:v libx264
-qmin 40 -qmax 51 -y output.mp4 " (which works as expected):

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
C:\Users\Admin\Desktop\Demo Videos>ffmpeg -i temp.mp4 -c:v libx264 -qmin 40
-qma
x 51 -y output.mp4
ffmpeg version N-63439-g96470ca Copyright (c) 2000-2014 the FFmpeg
developers
  built on May 25 2014 22:05:32 with gcc 4.8.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl
--enable-version3
 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig
--ena
ble-frei0r --enable-gnutls --enable-iconv --enable-libass
--enable-libbluray --e
nable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libi
lbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp
--enabl
e-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora
--enable
-libtwolame --enable-libvidstab --enable-libvo-aacenc
--enable-libvo-amrwbenc --
enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-l
ibx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink
--en
able-zlib
  libavutil      52. 86.100 / 52. 86.100
  libavcodec     55. 65.100 / 55. 65.100
  libavformat    55. 41.100 / 55. 41.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: M4V mp42isom
    creation_time   : 2014-06-03 08:00:14
  Duration: 00:00:03.97, start: 0.000000, bitrate: 433 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
smpte1
70m), 640x360 [SAR 1:1 DAR 16:9], 372 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc
(def
ault)
    Metadata:
      creation_time   : 2014-06-03 08:00:14
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 53
 kb/s (default)
    Metadata:
      creation_time   : 2014-06-03 08:00:14
      handler_name    : Sound Media Handler
[libx264 @ 02ef8940] using SAR=1/1
[libx264 @ 02ef8940] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 02ef8940] profile High, level 3.0
[libx264 @ 02ef8940] 264 - core 142 r2431 ac76440 - H.264/MPEG-4 AVC codec
- Cop
yleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1
chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0
decimate=1 i
nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2
b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
scenec
ut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60
qpmin=
40 qpmax=51 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: M4V mp42isom
    encoder         : Lavf55.41.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 6
40x360 [SAR 1:1 DAR 16:9], q=40-51, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2014-06-03 08:00:14
      handler_name    : Video Media Handler
      encoder         : Lavc55.65.100 libx264
    Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040),
44100
Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2014-06-03 08:00:14
      handler_name    : Sound Media Handler
      encoder         : Lavc55.65.100 libvo_aacenc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> libvo_aacenc)
Press [q] to stop, [?] for help
frame=  118 fps=0.0 q=-1.0 Lsize=     113kB time=00:00:03.98 bitrate=
233.5kbits
/s
video:46kB audio:63kB subtitle:0kB other streams:0kB global headers:0kB
muxing o
verhead: 4.585273%
[libx264 @ 02ef8940] frame I:2     Avg QP:40.03  size:   918
[libx264 @ 02ef8940] frame P:83    Avg QP:40.24  size:   472
[libx264 @ 02ef8940] frame B:33    Avg QP:40.31  size:   153
[libx264 @ 02ef8940] consecutive B-frames: 60.2%  6.8%  2.5% 30.5%
[libx264 @ 02ef8940] mb I  I16..4:  9.8% 88.7%  1.5%
[libx264 @ 02ef8940] mb P  I16..4:  4.6%  8.5%  0.2%  P16..4:  7.7%  0.8%
0.2%
 0.0%  0.0%    skip:78.0%
[libx264 @ 02ef8940] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 10.2%  0.3%
0.0%
 direct: 0.0%  skip:89.3%  L0:45.4% L1:54.1% BI: 0.4%
[libx264 @ 02ef8940] 8x8 transform intra:67.5% inter:91.4%
[libx264 @ 02ef8940] coded y,uvDC,uvAC intra: 11.1% 11.0% 0.5% inter: 0.9%
0.2%
0.0%
[libx264 @ 02ef8940] i16 v,h,dc,p: 43% 29% 10% 18%
[libx264 @ 02ef8940] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10%  9% 60%  2%  5%
2%  8%
 2%  2%
[libx264 @ 02ef8940] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 19% 25%  6% 12%  3%
17%
 3%  3%
[libx264 @ 02ef8940] i8c dc,h,v,p: 95%  2%  2%  1%
[libx264 @ 02ef8940] Weighted P-Frames: Y:4.8% UV:3.6%
[libx264 @ 02ef8940] ref P L0: 69.1% 15.5% 10.9%  4.5%  0.0%
[libx264 @ 02ef8940] ref B L0: 86.6% 12.8%  0.6%
[libx264 @ 02ef8940] ref B L1: 92.2%  7.8%
[libx264 @ 02ef8940] kb/s:93.79

C:\Users\Admin\Desktop\Demo Videos>

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Here is complete console output for: "ffmpeg -i temp.mp4 -c:v libx265 -qmin
40 -qmax 41 -y output.mp4 " (which does not work as expected):

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
C:\Users\Admin\Desktop\Demo Videos>ffmpeg -i temp.mp4 -c:v libx265 -qmin 40
-qma
x 41 -y output.mp4
ffmpeg version N-63439-g96470ca Copyright (c) 2000-2014 the FFmpeg
developers
  built on May 25 2014 22:05:32 with gcc 4.8.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl
--enable-version3
 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig
--ena
ble-frei0r --enable-gnutls --enable-iconv --enable-libass
--enable-libbluray --e
nable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libi
lbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp
--enabl
e-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora
--enable
-libtwolame --enable-libvidstab --enable-libvo-aacenc
--enable-libvo-amrwbenc --
enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-l
ibx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink
--en
able-zlib
  libavutil      52. 86.100 / 52. 86.100
  libavcodec     55. 65.100 / 55. 65.100
  libavformat    55. 41.100 / 55. 41.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: M4V mp42isom
    creation_time   : 2014-06-03 08:00:14
  Duration: 00:00:03.97, start: 0.000000, bitrate: 433 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
smpte1
70m), 640x360 [SAR 1:1 DAR 16:9], 372 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc
(def
ault)
    Metadata:
      creation_time   : 2014-06-03 08:00:14
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 53
 kb/s (default)
    Metadata:
      creation_time   : 2014-06-03 08:00:14
      handler_name    : Sound Media Handler
x265 [info]: HEVC encoder version 1.0+38-d0acf82a77f9
x265 [info]: build info [Windows][GCC 4.8.2][32 bit] 8bpp
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: WPP streams / pool / frames         : 6 / 4 / 2
x265 [info]: Main profile, Level-2.1 (Main tier)
x265 [info]: CU size                             : 64
x265 [info]: Max RQT depth inter / intra         : 1 / 1
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb / refs: 1 / 1 / 0 / 3
x265 [info]: Rate Control / AQ-Strength / CUTree : ABR-200 kbps / 1.0 / 1
x265 [info]: tools: rect amp rd=3 lft sao-lcu signhide
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: M4V mp42isom
    encoder         : Lavf55.41.100
    Stream #0:0(eng): Video: hevc (libx265) ([35][0][0][0] / 0x0023),
yuv420p, 6
40x360 [SAR 1:1 DAR 16:9], q=40-41, 200 kb/s, 30 fps, 15360 tbn, 30 tbc
(default
)
    Metadata:
      creation_time   : 2014-06-03 08:00:14
      handler_name    : Video Media Handler
      encoder         : Lavc55.65.100 libx265
    Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040),
44100
Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2014-06-03 08:00:14
      handler_name    : Sound Media Handler
      encoder         : Lavc55.65.100 libvo_aacenc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx265)
  Stream #0:1 -> #0:1 (aac -> libvo_aacenc)
Press [q] to stop, [?] for help
frame=   28 fps=0.0 q=0.0 size=       7kB time=00:00:00.98 bitrate=
60.9kbits/s
frame=   41 fps= 39 q=0.0 size=      18kB time=00:00:01.31 bitrate=
110.1kbits/s
frame=   51 fps= 32 q=0.0 size=      36kB time=00:00:01.63 bitrate=
181.6kbits/s
frame=   60 fps= 28 q=0.0 size=      51kB time=00:00:01.98 bitrate=
211.9kbits/s
frame=   69 fps= 26 q=0.0 size=      65kB time=00:00:02.30 bitrate=
229.1kbits/s
frame=   82 fps= 26 q=0.0 size=      78kB time=00:00:02.63 bitrate=
241.8kbits/s
frame=   93 fps= 25 q=0.0 size=      96kB time=00:00:02.98 bitrate=
264.7kbits/s
frame=  104 fps= 24 q=0.0 size=     108kB time=00:00:03.30 bitrate=
268.2kbits/s
frame=  114 fps= 24 q=0.0 size=     124kB time=00:00:03.65 bitrate=
278.6kbits/s
frame=  118 fps= 20 q=0.0 Lsize=     171kB time=00:00:03.98 bitrate=
352.1kbits/
s
video:103kB audio:63kB subtitle:0kB other streams:0kB global headers:0kB
muxing
overhead: 3.282767%
x265 [info]: frame I: 1      Avg QP:27.52  kb/s: 395.28
x265 [info]: frame P: 44     Avg QP:23.07  kb/s: 335.29
x265 [info]: frame B: 73     Avg QP:25.62  kb/s: 137.24
x265 [info]: global : 118    Avg QP:24.69  kb/s: 213.27
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 35.6% 17.8% 11.1% 20.0% 15.6%

C:\Users\Admin\Desktop\Demo Videos>
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Thanks in advance for any guidance/support!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140605/253364f6/attachment.html>


More information about the Libav-user mailing list