<div dir="ltr"><div><div><div><div><div><div><div><div>Hi,<br><br></div>First some background - I can use following command:<br><br>ffmpeg -i temp.mp4 -c:v libx264 -qmin 40 -qmax 51 -y output.mp4 <br><br></div>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.<br>
<br></div>So we apply same principle to libx265, using this command line:<br><br>ffmpeg -i temp.mp4 -c:v libx265 -qmin 40 -qmax 41 -y output.mp4 <br><br></div>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.<br>
<br></div>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?<br><br></div>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):<br>
<br>*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-<br>C:\Users\Admin\Desktop\Demo Videos>ffmpeg -i temp.mp4 -c:v libx264 -qmin 40 -qma<br>x 51 -y output.mp4<br>
ffmpeg version N-63439-g96470ca Copyright (c) 2000-2014 the FFmpeg developers<br> built on May 25 2014 22:05:32 with gcc 4.8.2 (GCC)<br> configuration: --disable-static --enable-shared --enable-gpl --enable-version3<br>
--disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --ena<br>ble-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --e<br>nable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libi<br>
lbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-<br>libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enabl<br>e-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable<br>
-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --<br>enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-l<br>ibx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --en<br>
able-zlib<br> libavutil 52. 86.100 / 52. 86.100<br> libavcodec 55. 65.100 / 55. 65.100<br> libavformat 55. 41.100 / 55. 41.100<br> libavdevice 55. 13.101 / 55. 13.101<br> libavfilter 4. 5.100 / 4. 5.100<br>
libswscale 2. 6.100 / 2. 6.100<br> libswresample 0. 19.100 / 0. 19.100<br> libpostproc 52. 3.100 / 52. 3.100<br>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':<br> Metadata:<br> major_brand : mp42<br>
minor_version : 1<br> compatible_brands: M4V mp42isom<br> creation_time : 2014-06-03 08:00:14<br> Duration: 00:00:03.97, start: 0.000000, bitrate: 433 kb/s<br> Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte1<br>
70m), 640x360 [SAR 1:1 DAR 16:9], 372 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (def<br>ault)<br> Metadata:<br> creation_time : 2014-06-03 08:00:14<br> handler_name : Video Media Handler<br> encoder : AVC Coding<br>
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 53<br> kb/s (default)<br> Metadata:<br> creation_time : 2014-06-03 08:00:14<br> handler_name : Sound Media Handler<br>[libx264 @ 02ef8940] using SAR=1/1<br>
[libx264 @ 02ef8940] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX<br>[libx264 @ 02ef8940] profile High, level 3.0<br>[libx264 @ 02ef8940] 264 - core 142 r2431 ac76440 - H.264/MPEG-4 AVC codec - Cop<br>yleft 2003-2014 - <a href="http://www.videolan.org/x264.html">http://www.videolan.org/x264.html</a> - options: cabac=1 ref=3 deb<br>
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m<br>e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro<br>ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i<br>
nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1<br>b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenec<br>ut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=<br>
40 qpmax=51 qpstep=4 ip_ratio=1.40 aq=1:1.00<br>Output #0, mp4, to 'output.mp4':<br> Metadata:<br> major_brand : mp42<br> minor_version : 1<br> compatible_brands: M4V mp42isom<br> encoder : Lavf55.41.100<br>
Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 6<br>40x360 [SAR 1:1 DAR 16:9], q=40-51, 30 fps, 15360 tbn, 30 tbc (default)<br> Metadata:<br> creation_time : 2014-06-03 08:00:14<br>
handler_name : Video Media Handler<br> encoder : Lavc55.65.100 libx264<br> Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100<br>Hz, stereo, s16, 128 kb/s (default)<br> Metadata:<br>
creation_time : 2014-06-03 08:00:14<br> handler_name : Sound Media Handler<br> encoder : Lavc55.65.100 libvo_aacenc<br>Stream mapping:<br> Stream #0:0 -> #0:0 (h264 -> libx264)<br> Stream #0:1 -> #0:1 (aac -> libvo_aacenc)<br>
Press [q] to stop, [?] for help<br>frame= 118 fps=0.0 q=-1.0 Lsize= 113kB time=00:00:03.98 bitrate= 233.5kbits<br>/s<br>video:46kB audio:63kB subtitle:0kB other streams:0kB global headers:0kB muxing o<br>verhead: 4.585273%<br>
[libx264 @ 02ef8940] frame I:2 Avg QP:40.03 size: 918<br>[libx264 @ 02ef8940] frame P:83 Avg QP:40.24 size: 472<br>[libx264 @ 02ef8940] frame B:33 Avg QP:40.31 size: 153<br>[libx264 @ 02ef8940] consecutive B-frames: 60.2% 6.8% 2.5% 30.5%<br>
[libx264 @ 02ef8940] mb I I16..4: 9.8% 88.7% 1.5%<br>[libx264 @ 02ef8940] mb P I16..4: 4.6% 8.5% 0.2% P16..4: 7.7% 0.8% 0.2%<br> 0.0% 0.0% skip:78.0%<br>[libx264 @ 02ef8940] mb B I16..4: 0.1% 0.1% 0.0% B16..8: 10.2% 0.3% 0.0%<br>
direct: 0.0% skip:89.3% L0:45.4% L1:54.1% BI: 0.4%<br>[libx264 @ 02ef8940] 8x8 transform intra:67.5% inter:91.4%<br>[libx264 @ 02ef8940] coded y,uvDC,uvAC intra: 11.1% 11.0% 0.5% inter: 0.9% 0.2%<br>0.0%<br>[libx264 @ 02ef8940] i16 v,h,dc,p: 43% 29% 10% 18%<br>
[libx264 @ 02ef8940] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 9% 60% 2% 5% 2% 8%<br> 2% 2%<br>[libx264 @ 02ef8940] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 19% 25% 6% 12% 3% 17%<br> 3% 3%<br>[libx264 @ 02ef8940] i8c dc,h,v,p: 95% 2% 2% 1%<br>
[libx264 @ 02ef8940] Weighted P-Frames: Y:4.8% UV:3.6%<br>[libx264 @ 02ef8940] ref P L0: 69.1% 15.5% 10.9% 4.5% 0.0%<br>[libx264 @ 02ef8940] ref B L0: 86.6% 12.8% 0.6%<br>[libx264 @ 02ef8940] ref B L1: 92.2% 7.8%<br>[libx264 @ 02ef8940] kb/s:93.79<br>
<br>C:\Users\Admin\Desktop\Demo Videos><br><br>*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-<br><br></div>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):<br>
<br>*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-<br>C:\Users\Admin\Desktop\Demo Videos>ffmpeg -i temp.mp4 -c:v libx265 -qmin 40 -qma<br>x 41 -y output.mp4<br>
ffmpeg version N-63439-g96470ca Copyright (c) 2000-2014 the FFmpeg developers<br> built on May 25 2014 22:05:32 with gcc 4.8.2 (GCC)<br> configuration: --disable-static --enable-shared --enable-gpl --enable-version3<br>
--disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --ena<br>ble-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --e<br>nable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libi<br>
lbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-<br>libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enabl<br>e-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable<br>
-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --<br>enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-l<br>ibx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --en<br>
able-zlib<br> libavutil 52. 86.100 / 52. 86.100<br> libavcodec 55. 65.100 / 55. 65.100<br> libavformat 55. 41.100 / 55. 41.100<br> libavdevice 55. 13.101 / 55. 13.101<br> libavfilter 4. 5.100 / 4. 5.100<br>
libswscale 2. 6.100 / 2. 6.100<br> libswresample 0. 19.100 / 0. 19.100<br> libpostproc 52. 3.100 / 52. 3.100<br>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'temp.mp4':<br> Metadata:<br> major_brand : mp42<br>
minor_version : 1<br> compatible_brands: M4V mp42isom<br> creation_time : 2014-06-03 08:00:14<br> Duration: 00:00:03.97, start: 0.000000, bitrate: 433 kb/s<br> Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte1<br>
70m), 640x360 [SAR 1:1 DAR 16:9], 372 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (def<br>ault)<br> Metadata:<br> creation_time : 2014-06-03 08:00:14<br> handler_name : Video Media Handler<br> encoder : AVC Coding<br>
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 53<br> kb/s (default)<br> Metadata:<br> creation_time : 2014-06-03 08:00:14<br> handler_name : Sound Media Handler<br>x265 [info]: HEVC encoder version 1.0+38-d0acf82a77f9<br>
x265 [info]: build info [Windows][GCC 4.8.2][32 bit] 8bpp<br>x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX<br>x265 [info]: WPP streams / pool / frames : 6 / 4 / 2<br>x265 [info]: Main profile, Level-2.1 (Main tier)<br>
x265 [info]: CU size : 64<br>x265 [info]: Max RQT depth inter / intra : 1 / 1<br>x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 2<br>x265 [info]: Keyframe min / max / scenecut : 25 / 250 / 40<br>
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2<br>x265 [info]: b-pyramid / weightp / weightb / refs: 1 / 1 / 0 / 3<br>x265 [info]: Rate Control / AQ-Strength / CUTree : ABR-200 kbps / 1.0 / 1<br>x265 [info]: tools: rect amp rd=3 lft sao-lcu signhide<br>
Output #0, mp4, to 'output.mp4':<br> Metadata:<br> major_brand : mp42<br> minor_version : 1<br> compatible_brands: M4V mp42isom<br> encoder : Lavf55.41.100<br> Stream #0:0(eng): Video: hevc (libx265) ([35][0][0][0] / 0x0023), yuv420p, 6<br>
40x360 [SAR 1:1 DAR 16:9], q=40-41, 200 kb/s, 30 fps, 15360 tbn, 30 tbc (default<br>)<br> Metadata:<br> creation_time : 2014-06-03 08:00:14<br> handler_name : Video Media Handler<br> encoder : Lavc55.65.100 libx265<br>
Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100<br>Hz, stereo, s16, 128 kb/s (default)<br> Metadata:<br> creation_time : 2014-06-03 08:00:14<br> handler_name : Sound Media Handler<br>
encoder : Lavc55.65.100 libvo_aacenc<br>Stream mapping:<br> Stream #0:0 -> #0:0 (h264 -> libx265)<br> Stream #0:1 -> #0:1 (aac -> libvo_aacenc)<br>Press [q] to stop, [?] for help<br>frame= 28 fps=0.0 q=0.0 size= 7kB time=00:00:00.98 bitrate= 60.9kbits/s<br>
frame= 41 fps= 39 q=0.0 size= 18kB time=00:00:01.31 bitrate= 110.1kbits/s<br>frame= 51 fps= 32 q=0.0 size= 36kB time=00:00:01.63 bitrate= 181.6kbits/s<br>frame= 60 fps= 28 q=0.0 size= 51kB time=00:00:01.98 bitrate= 211.9kbits/s<br>
frame= 69 fps= 26 q=0.0 size= 65kB time=00:00:02.30 bitrate= 229.1kbits/s<br>frame= 82 fps= 26 q=0.0 size= 78kB time=00:00:02.63 bitrate= 241.8kbits/s<br>frame= 93 fps= 25 q=0.0 size= 96kB time=00:00:02.98 bitrate= 264.7kbits/s<br>
frame= 104 fps= 24 q=0.0 size= 108kB time=00:00:03.30 bitrate= 268.2kbits/s<br>frame= 114 fps= 24 q=0.0 size= 124kB time=00:00:03.65 bitrate= 278.6kbits/s<br>frame= 118 fps= 20 q=0.0 Lsize= 171kB time=00:00:03.98 bitrate= 352.1kbits/<br>
s<br>video:103kB audio:63kB subtitle:0kB other streams:0kB global headers:0kB muxing<br>overhead: 3.282767%<br>x265 [info]: frame I: 1 Avg QP:27.52 kb/s: 395.28<br>x265 [info]: frame P: 44 Avg QP:23.07 kb/s: 335.29<br>
x265 [info]: frame B: 73 Avg QP:25.62 kb/s: 137.24<br>x265 [info]: global : 118 Avg QP:24.69 kb/s: 213.27<br>x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%<br>x265 [info]: consecutive B-frames: 35.6% 17.8% 11.1% 20.0% 15.6%<br>
<br>C:\Users\Admin\Desktop\Demo Videos><br>*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-<br><br></div>Thanks in advance for any guidance/support!<br></div>