[x265] Random grey frames (corrupted) while encoding video sequence

Vasiliy Volkov volk.vasiliy at gmail.com
Tue May 8 21:44:25 CEST 2018


Any clues?
I've found that bug can be reproduced even with simple settings:

ffmpeg -threads auto -i pipe:0 -s 1920x1080 -codec:0 libx265 -preset:0
ultrafast -x265-params:0
fps=50:keyint=50:hrd=1:vbv-maxrate=20000:vbv-bufsize=40000:bitrate=18000
-map 0:v -codec:1 copy -map 0:a -muxrate 26000000 -max_delay 2500000 -f:0
mpegts < input.ts > out.ts




пн, 7 мая 2018 г. в 23:40, Vasiliy Volkov <volk.vasiliy at gmail.com>:

> Hi,
>
> I've encounter strange issue while working with libx265 2.7 and ffmpeg
> 4.0: while encoding, within ten minutes (maybe more maybe less), in my
> encoded stream grey frames appear (one or several times in a row) and then
> they disappear with large grey pixels and original stream images return
> back and everything goes fine. Then problem repeats.
>
> Input stream decodes well, ffmpeg print no error, resulted HEVC bitstream
> successfully decoded by VLC or any other software (ffplay) (or hardware,
> I've tried Amlogic S905) but while playing video sequence contains grey
> frame and looks corrupted sometimes. Here is example of corrupted output
> sequence: https://yadi.sk/d/BNC7n7dJ3VVdxD
>
> It has random nature, it does not depend on input stream, it doesn't
> depend on particular subsequence within input stream (I've tried to
> reencode same sequence and everything went fine without any image
> degradation).
>
> The description is very close to this ffmpeg bug:
> https://trac.ffmpeg.org/ticket/6814
> but in my case I definitely has no decoder corruption, and FFmpeg
> definitely (I've checked it with function and check raw frames) sends to
> libx265 encoder well decoded frames. So it looks like libx265 encoder bug.
>
> A csv sheet with metrics from libx265 while output stream contains grey
> frame: https://yadi.sk/i/xVSfm6ph3VW47j
>
> Also that grey frames actually YUV with every byte == 128
>
> I've checked: master libx265, release 2.7, release 2.6 -- problem
> everywhere.
>
> This is my encoding commands (maybe here is error in codec params?):
>
> ffmpeg -threads auto -i pipe:0 -s 1920x1080 -codec:0 libx265 -preset:0
> ultrafast -x265-params:0
> hdr=1:colorprim=9:transfer=18:colormatrix=9:fps=50:keyint=50:min-keyint=50:bframes=3:hrd=1:ref=3:vbv-maxrate=20000:vbv-bufsize=40000:bitrate=18000:rc-lookahead=4:no-scenecut=1:repeat-headers=1:no-open-gop=1:aud=1:no-info=1:level-idc=5.1:min-cu-size=16:merange=42:lookahead-threads=10:frame-threads=10:csv=ffmpeg-4.0-2.7.csv:csv-log-level=1
> -streamid 0:101 -map '#0xc8' -codec:1 copy -threads:1 2 -streamid 1:110
> -map '#0xca' -muxrate 26000000 -max_delay 2500000 -f:0 mpegts pipe:1 < /tmp/
> pipe.in > /tmp/pipe.ts
>
>
> ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
>   built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609
>   configuration: --prefix=/usr/local --pkg-config-flags=--static
> --enable-static --enable-nonfree --disable-shared
> --enable-runtime-cpudetect --extra-cflags=-ftree-vectorize
> --extra-cflags='-march=native' --extra-cflags=-O3
> --extra-cflags=-fuse-linker-plugin --enable-pic --enable-lto --ar=gcc-ar
> --ranlib=true --enable-gpl --enable-libx264 --enable-libx265
> --enable-libmp3lame --extra-libs=-lpthread
>
>
> libx265 version info:
> x265 [info]: HEVC encoder version 2.7
> x265 [info]: build info [Linux][GCC 5.4.0][64 bit] 10bit
> x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX
> FMA3 BMI2 AVX2
>
> My CPU setup:
> # lscpu
> Architecture:          x86_64
> CPU op-mode(s):        32-bit, 64-bit
> Byte Order:            Little Endian
> CPU(s):                88
> On-line CPU(s) list:   0-87
> Thread(s) per core:    2
> Core(s) per socket:    22
> Socket(s):             2
> NUMA node(s):          2
> Vendor ID:             GenuineIntel
> CPU family:            6
> Model:                 79
> Model name:            Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
> Stepping:              1
> CPU MHz:               2195.105
> BogoMIPS:              4391.78
> Virtualization:        VT-x
> L1d cache:             32K
> L1i cache:             32K
> L2 cache:              256K
> L3 cache:              56320K
> NUMA node0 CPU(s):     0-21,44-65
> NUMA node1 CPU(s):     22-43,66-87
> Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr
> pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
> syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good
> nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 ds_cpl
> vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic
> movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
> 3dnowprefetch arat epb pln pts dtherm intel_pt tpr_shadow vnmi flexpriority
> ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm
> rdseed adx smap xsaveopt cqm_llc cqm_occup_llc
>
>
> Here is also x265 command specified same parameters (raw decoded stream
> needed):
> x265 --input - --input-res 1920x1080 -p ultrafast --fps 50 --hrd --aud
> --repeat-headers --bitrate 18000 --vbv-maxrate 20000 --vbv-bufsize 40000
> --bframes 3 --no-scenecut --rc-lookahead 4 --min-keyint 50 --keyint 50
> --no-open-gop --ref 3 --merange 42 --min-cu-size 16 --frame-threads 10
> --level-idc 5.1 --lookahead-slices 8 --lookahead-threads 10 --colorprim
> bt2020 --transfer arib-std-b67 --hdr --no-info --input-depth 10
> --output-depth 10 -o out.h265
>
>
> Mpegts input stream: https://yadi.sk/d/NtTPUVnq3VVuFG
>
> Can be decoded with command: ffmpeg3 -re -i uhd_input.ts -s 1920x1080 -f
> rawvideo pipe:1 > /tmp/pipe.yuv
>
> How can I investigate it further? Do you already encounter that?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180508/aa92297c/attachment-0001.html>


More information about the x265-devel mailing list