Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5715 closed defect (worksforme)

FFMpeg 3.1.1 doesn't pass any options to x265 2.0 when using x265-params

Reported by: Artem S. Tashkinov Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: libx265
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
How to reproduce:

$ ffmpeg -i 1.mkv -c:v libx265 -preset placebo -x265-params crf=22:rdoq-level=1:merange=40:ctu=32:max-tu-size=16:no-sao out.mkv
ffmpeg version 3.1.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8
  configuration: --prefix=/var/encode --enable-gpl --enable-version3 --enable-nonfree --enable-gray --enable-avresample --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libx264 --enable-libx265 --enable-libxvid --enable-pthreads --extra-libs='-ldl -lstdc++'

The resulting file has a different CRF, different rdoq-level, merange, ctu, etc. etc. etc. :

x265 (build 87) - 2.0:[Linux]
[GCC 4.8.4][64 bit] 8bit - H.265/HEVC codec - Copyright 2013-2015 (c) Multicoreware Inc - - options: 640x480 fps=15/1 bitdepth=8 wpp ctu=64 min-cu-size=8 max-tu-size=32 tu-intra-depth=4 tu-inter-depth=4 me=3 subme=5 merange=92 rect amp max-merge=5 temporal-mvp no-early-skip no-rskip rdpenalty=0 tskip no-tskip-fast strong-intra-smoothing no-lossless no-cu-lossless no-constrained-intra no-fast-intra open-gop no-temporal-layers interlace=0 keyint=250 min-keyint=15 scenecut=40 rc-lookahead=60 lookahead-slices=0 bframes=8 bframe-bias=0 b-adapt=2 ref=5 limit-refs=0 no-limit-modes weightp weightb aq-mode=1 qg-size=32 aq-strength=1.00 cbqpoffs=0 crqpoffs=0 rd=6 psy-rd=2.00 rdoq-level=2 psy-rdoq=1.00 no-rd-refine signhide deblock=0:0 sao no-sao-non-deblock b-pyramid cutree no-intra-refresh rc=crf crf=28.0 qcomp=0.60 qpmin=0 qpmax=51 qpstep=4 ipratio=1.40 pbratio=1.30

Perhaps it's a dupe of bug 4284 but this time everything is even more broken.

Change History (7)

comment:1 by Artem S. Tashkinov, 6 years ago

Another critical issue is that unknown parameters are simply ignored. They are not reported, they don't cause termination or anything - that should be fixed as well.

comment:2 by Carl Eugen Hoyos, 6 years ago

Keywords: libx265 added; x265 removed
Priority: criticalnormal

Please test current FFmpeg git head and provide the command line that allows to reproduce the issue together with the complete, uncut console output to make this a valid ticket.

comment:3 by Artem S. Tashkinov, 6 years ago

Resolution: wontfix
Status: newclosed

If it's so difficult for you to run a single command to see the results immediately, just don't bother. No, git head doesn't have any changes in regard to parsing x265 arguments (I've just checked the last three months of the commit history) - it's pointless to test it.

comment:4 by easyfab, 6 years ago

You must speficy a value for each parameter.
You can't set just no-sao but no-sao=1

It should work fine with that.

in reply to:  4 comment:5 by Artem S. Tashkinov, 6 years ago

Replying to easyfab:

You must speficy a value for each parameter.
You can't set just no-sao but no-sao=1

It should work fine with that.

All other arguments are ignored as well as seen in the output:

Input : crf=22:rdoq-level=1:merange=40:ctu=32:max-tu-size=16
Output: crf=28 rdoq-level=2 merange=92 ctu=64 max-tu-size=32

Frankly speaking I don't know what to add.

comment:6 by James, 6 years ago

Resolution: wontfixworksforme

Works for me after adding the value 1 to no-sao, and also after removing the parameter altogether.

$ ./ffmpeg -i test.y4m -c:v libx265 -preset placebo -x265-params crf=22:rdoq-level=1:merange=40:ctu=32:max-tu-size=16:no-sao=1 -f null -
ffmpeg version n3.1.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 6.1.1 (GCC) 20160602
  configuration: --enable-gpl --enable-libx265 --prefix=/usr
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, yuv4mpegpipe, from 'test.y4m':
  Duration: 00:00:03.00, start: 0.000000, bitrate: 265156 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
x265 [info]: HEVC encoder version 2.0+1-6a9b6a828f79
x265 [info]: build info [Linux][GCC 6.1.1][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Main profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: frame threads / pool features       : 2 / wpp(23 rows)
x265 [info]: Coding QT: max CU size, min CU size : 32 / 8
x265 [info]: Residual QT: max TU size, max depth : 16 / 4 inter / 4 intra
x265 [info]: ME / range / subpel / merge         : star / 40 / 5 / 5
x265 [info]: Keyframe min / max / scenecut       : 23 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 60 / 8 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 1
x265 [info]: References / ref-limit  cu / depth  : 5 / off / off
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-22.0 / 0.60
x265 [info]: tools: rect amp rd=6 psy-rd=2.00 rdoq=1 psy-rdoq=1.00 tskip
x265 [info]: tools: signhide tmvp b-intra strong-intra-smoothing deblock
[null @ 0x2d50760] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, null, to 'pipe:':
    encoder         : Lavf57.41.100
    Stream #0:0: Video: hevc (libx265), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbn, 23.98 tbc
      encoder         : Lavc57.48.101 libx265
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> hevc (libx265))
Press [q] to stop, [?] for help
frame=   72 fps=0.8 q=-0.0 Lsize=N/A time=00:00:02.91 bitrate=N/A speed=0.0333x
video:632kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
x265 [info]: frame I:      3, Avg QP:21.34  kb/s: 6364.96
x265 [info]: frame P:     15, Avg QP:23.00  kb/s: 3569.69
x265 [info]: frame B:     54, Avg QP:27.50  kb/s: 941.05
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: Weighted B-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 16.7% 5.6% 16.7% 16.7% 11.1% 33.3% 0.0% 0.0% 0.0%

encoded 72 frames in 87.74s (0.82 fps), 1714.68 kb/s, Avg QP:26.31

comment:7 by Artem S. Tashkinov, 6 years ago

Thanks for testing, I will try to use x265 as an external library then. I really don't understand why it works for you and doesn't work for me.

Note: See TracTickets for help on using tickets.