Opened 12 days ago

Closed 4 days ago

#6814 closed defect (needs_more_info)

Nondeterministic corruption outputting h.265 /w threading enabled

Reported by: audiotoaster Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: libx265
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Have been trying to track down a problem with random corruption for about a month when converting ~1080 video from h.264 to h.265.

Tried various versions of ffmpeg 3.3, 3.4 and various nightlies from zeranoe including 32-bit and 64-bit versions. All seem to produce similar results.

Problem is seemingly completely random. It can happen as often as multiple times within an hour of outputted video or once every several hours.

When corruption is found simply re-encoding same video using same process results in either no corruption or corruption somewhere else in the output video.

No errors are ever displayed in the ffmpeg output related to corrupt output.

Only solution I have found which has completely resolved the problem for me is to disable thread pools in libx265.

Currently:

ffmpeg version N-88514-gd5995c531d Copyright (c) 2000-2017 the FFmpeg developers

built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --ena
ble-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus
--enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enabl
e-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx2
64 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zli
b --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuv
id --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-lib
mfx
libavutil      56.  0.100 / 56.  0.100
libavcodec     58.  1.100 / 58.  1.100
libavformat    58.  0.102 / 58.  0.102
libavdevice    58.  0.100 / 58.  0.100
libavfilter     7.  0.101 /  7.  0.101
libswscale      5.  0.101 /  5.  0.101
libswresample   3.  0.101 /  3.  0.101
libpostproc    55.  0.100 / 55.  0.100

System is Win7 /w Intel i7 4770k. Quad core /w HT enabled.

Example CLI where random corruption occurs

ffmpeg -i "sourceh264.mkv" -vf crop=1440:1072:240:4  -c:v libx265 -crf 19 -map_metadata -1 -sn "outputh265.mkv"

Example CLI with no corruption (threading disabled)

ffmpeg -i "sourceh264.mkv" -vf crop=1440:1072:240:4  -c:v libx265 -crf 19 -x265-params frame-threads=1:pools=none -map_metadata -1 -sn "outputh265.mkv"

Problem appears to be completely independent of input video. In my case input is always h264. The crop parameters vary with each input video.

Since disabling threading solves the problem for me changed workflow slightly to run a half dozen instances of ffmpeg concurrently to keep all cores busy.

Change History (2)

comment:1 Changed 12 days ago by cehoyos

If the issue is reproducible independently of the input video, please provide the command line you tested together with the complete, uncut console output for an input video that we also have access to to make this a valid ticket.
Note that for multi-threaded encoding, you are expected to get different (non-deterministic) output, of course without corruption if the input video is corruption-free.
If the issue is only reproducible with libx265 output, it is likely that a possible issue cannot be fixed within FFmpeg and you should test with rawvideo input and the x265 binary.

comment:2 Changed 4 days ago by cehoyos

  • Keywords libx265 added
  • Resolution set to needs_more_info
  • Status changed from new to closed

Please reopen this ticket if you can add any additional information.

Note: See TracTickets for help on using tickets.