[FFmpeg-user] x265 encoded with yuvj444p plays back as yuvj420p

Ferdi Scholten ferdi at sttc-nlp.nl
Thu Feb 3 23:23:37 EET 2022


Hi, I have a screen recording made with OBS that's originally encoded
> with H.264 with the yuvj444p pixel format. Here's the sample I used:
> https://0x0.st/oHn-.mkv
>
> I want to re-encode this as H.265, so I used the following ffmpeg command:
>> ffmpeg -i input.mkv -codec:v libx265 -preset fast -crf 22 -codec:a copy output.mkv
> Here's the sample I obtained out of it: https://0x0.st/oHnX.mkv
>
> But when I play the x265-encoded version back in VLC or ffplay, it
> seems to assume the pixel format is yuvj420p, resulting in colours
> being in the wrong places.
>
> What am I doing wrong?
> Below is the full CLI output of ffmpeg and ffplay
>
> $ ffmpeg -i '2022-02-04 07-48-33.mkv' -codec:v libx265 -preset fast
> -crf 22 -codec:a copy /tmp/a.mkv
> ffmpeg version 4.4.1-3 Copyright (c) 2000-2021 the FFmpeg developers
>    built with gcc 11 (Debian 11.2.0-14)
>    configuration: --prefix=/usr --extra-version=3 --toolchain=hardened
> --libdir=/usr/lib/x86_64-linux-gnu
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
> --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> --enable-libcdio --enable-libcodec2 --enable-libdav1d
> --enable-libflite --enable-libfontconfig --enable-libfreetype
> --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack
> --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg
> --enable-libopenmpt --enable-libopus --enable-libpulse
> --enable-librabbitmq --enable-librubberband --enable-libshine
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
> --enable-libssh --enable-libtheora --enable-libtwolame
> --enable-libvidstab --enable-libvorbis --enable-libvpx
> --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid
> --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2
> --enable-omx --enable-openal --enable-opencl --enable-opengl
> --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx
> --enable-libdc1394 --enable-libdrm --enable-libiec61883
> --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
>    WARNING: library configuration mismatch
>    avcodec     configuration: --prefix=/usr --extra-version=3
> --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
> --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> --enable-libcdio --enable-libcodec2 --enable-libdav1d
> --enable-libflite --enable-libfontconfig --enable-libfreetype
> --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack
> --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg
> --enable-libopenmpt --enable-libopus --enable-libpulse
> --enable-librabbitmq --enable-librubberband --enable-libshine
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
> --enable-libssh --enable-libtheora --enable-libtwolame
> --enable-libvidstab --enable-libvorbis --enable-libvpx
> --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid
> --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2
> --enable-omx --enable-openal --enable-opencl --enable-opengl
> --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx
> --enable-libdc1394 --enable-libdrm --enable-libiec61883
> --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
> --enable-version3 --disable-doc --disable-programs --enable-libaribb24
> --enable-libopencore_amrnb --enable-libopencore_amrwb
> --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
>    libavutil      56. 70.100 / 56. 70.100
>    libavcodec     58.134.100 / 58.134.100
>    libavformat    58. 76.100 / 58. 76.100
>    libavdevice    58. 13.100 / 58. 13.100
>    libavfilter     7.110.100 /  7.110.100
>    libswscale      5.  9.100 /  5.  9.100
>    libswresample   3.  9.100 /  3.  9.100
>    libpostproc    55.  9.100 / 55.  9.100
> Input #0, matroska,webm, from '2022-02-04 07-48-33.mkv':
>    Metadata:
>      ENCODER         : Lavf58.76.100
>    Duration: 00:00:02.02, start: 0.000000, bitrate: 1908 kb/s
>    Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuvj444p(pc,
> bt709/bt709/iec61966-2-1, progressive), 2560x1440 [SAR 1:1 DAR 16:9],
> 60 fps, 60 tbr, 1k tbn, 120 tbc (default)
>      Metadata:
>        DURATION        : 00:00:02.017000000
>    Stream #0:1: Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
>      Metadata:
>        title           : Track1
>        DURATION        : 00:00:02.005000000
> Stream mapping:
>    Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
>    Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
> x265 [info]: build info [Linux][GCC 10.3.0][64 bit] 8bit+10bit+12bit
> x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2
> AVX FMA3 BMI2 AVX2
> x265 [info]: Main profile, Level-5 (Main tier)
> x265 [info]: Thread pool 0 using 48 threads on numa nodes 0,1,2,3
> x265 [info]: Slices                              : 1
> x265 [info]: frame threads / pool features       : 5 / wpp(23 rows)
> libnuma: Warning: node 0 not allowed
> x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
> x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
> x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
> x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00
> x265 [info]: Lookahead / bframes / badapt        : 15 / 4 / 0
> x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
> x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
> x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
> x265 [info]: Rate Control / qCompress            : CRF-22.0 / 0.60
> x265 [info]: tools: rd=2 psy-rd=2.00 rskip mode=1 signhide tmvp fast-intra
> x265 [info]: tools: strong-intra-smoothing lslices=8 deblock sao
> Output #0, matroska, to '/tmp/a.mkv':
>    Metadata:
>      encoder         : Lavf58.76.100
>    Stream #0:0: Video: hevc, yuvj444p(pc, bt709/bt709/iec61966-2-1,
> progressive), 2560x1440 [SAR 1:1 DAR 16:9], q=2-31, 60 fps, 1k tbn
> (default)
>      Metadata:
>        DURATION        : 00:00:02.017000000
>        encoder         : Lavc58.134.100 libx265
>      Side data:
>        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
>    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz,
> 5.1, fltp (default)
>      Metadata:
>        title           : Track1
>        DURATION        : 00:00:02.005000000
> frame=  121 fps=107 q=32.9 Lsize=     144kB time=00:00:02.00 bitrate=
> 587.2kbits/s speed=1.77x
> video:137kB audio:2kB subtitle:0kB other streams:0kB global
> headers:2kB muxing overhead: 3.229585%
> x265 [info]: frame I:      1, Avg QP:25.28  kb/s: 52256.64
> x265 [info]: frame P:     24, Avg QP:29.55  kb/s: 172.86
> x265 [info]: frame B:     96, Avg QP:32.69  kb/s: 113.78
> x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
> x265 [info]: consecutive B-frames: 4.0% 0.0% 0.0% 0.0% 96.0%
>
> encoded 121 frames in 1.07s (112.58 fps), 556.44 kb/s, Avg QP:32.00
>
>
>
> $ ffplay /tmp/a.mkv
> ffplay version 4.4.1-3 Copyright (c) 2003-2021 the FFmpeg developers
>    built with gcc 11 (Debian 11.2.0-14)
>    configuration: --prefix=/usr --extra-version=3 --toolchain=hardened
> --libdir=/usr/lib/x86_64-linux-gnu
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
> --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> --enable-libcdio --enable-libcodec2 --enable-libdav1d
> --enable-libflite --enable-libfontconfig --enable-libfreetype
> --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack
> --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg
> --enable-libopenmpt --enable-libopus --enable-libpulse
> --enable-librabbitmq --enable-librubberband --enable-libshine
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
> --enable-libssh --enable-libtheora --enable-libtwolame
> --enable-libvidstab --enable-libvorbis --enable-libvpx
> --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid
> --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2
> --enable-omx --enable-openal --enable-opencl --enable-opengl
> --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx
> --enable-libdc1394 --enable-libdrm --enable-libiec61883
> --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
>    WARNING: library configuration mismatch
>    avcodec     configuration: --prefix=/usr --extra-version=3
> --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
> --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
> --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom
> --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
> --enable-libcdio --enable-libcodec2 --enable-libdav1d
> --enable-libflite --enable-libfontconfig --enable-libfreetype
> --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack
> --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg
> --enable-libopenmpt --enable-libopus --enable-libpulse
> --enable-librabbitmq --enable-librubberband --enable-libshine
> --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt
> --enable-libssh --enable-libtheora --enable-libtwolame
> --enable-libvidstab --enable-libvorbis --enable-libvpx
> --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid
> --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2
> --enable-omx --enable-openal --enable-opencl --enable-opengl
> --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx
> --enable-libdc1394 --enable-libdrm --enable-libiec61883
> --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
> --enable-version3 --disable-doc --disable-programs --enable-libaribb24
> --enable-libopencore_amrnb --enable-libopencore_amrwb
> --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
>    libavutil      56. 70.100 / 56. 70.100
>    libavcodec     58.134.100 / 58.134.100
>    libavformat    58. 76.100 / 58. 76.100
>    libavdevice    58. 13.100 / 58. 13.100
>    libavfilter     7.110.100 /  7.110.100
>    libswscale      5.  9.100 /  5.  9.100
>    libswresample   3.  9.100 /  3.  9.100
>    libpostproc    55.  9.100 / 55.  9.100
> Input #0, matroska,webm, from '/tmp/a.mkv':   0KB sq=    0B f=0/0
>    Metadata:
>      ENCODER         : Lavf58.76.100
>    Duration: 00:00:02.03, start: 0.000000, bitrate: 581 kb/s
>    Stream #0:0: Video: hevc (Main), yuvj420p(pc,
> bt709/bt709/iec61966-2-1, progressive), 2560x1440 [SAR 1:1 DAR 16:9],
> 60 fps, 60 tbr, 1k tbn, 60 tbc (default)
>      Metadata:
>        ENCODER         : Lavc58.134.100 libx265
>        DURATION        : 00:00:02.017000000
>    Stream #0:1: Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
>      Metadata:
>        title           : Track1
>        DURATION        : 00:00:02.026000000
> [swscaler @ 0x7efdadf2fcc0] deprecated pixel format used, make sure
> you did set range correctly
>     3.26 A-V: -0.019 fd=   6 aq=    0KB vq=    0KB sq=    0B f=0/0
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
You are encoding with the main profile. That only supports 4:2:0 chroma 
sampling. Use another profile.


More information about the ffmpeg-user mailing list