[Libav-user] libx264 randomly causing image tearing

DeHackEd git at dehacked.net
Wed Jun 15 17:16:43 CEST 2016


I have a custom libav* application that produces HLS (effectively mpegts) output in AAC and H264 using libx264.

Everything is working fine except for one anomaly. Occasionally I get this "tearing" effect (screen shot link at bottom
of message) for a split second where it looks like the top portion of the frame, usually around 1/3 of it, looks like a
frame from another part of the video. It is most noticeable around scene cuts but otherwise doesn't have any pattern.
Just a glitch of sorts every few seconds.

The application is fairly complex, multithreaded and uses filters. It seems to be somehow dependent on the input as some
source videos are fine while others do this tearing thing. The not-so-simple things I am doing are:

* Setting the time base for libx264 to 1/90000 to match the input source so I can just copy timestamps from mpegts input
to output. Actual framerate is 29.97fps
* Custom libx264 options, including no-scenecut
* Full VBV settings in one-pass mode
* ticks_per_frame=2 as per docs and examples

Switching to ffv1 I don't see any issues in the output so I'm fairly certain it's an libx264 or other encoding side issue.

Anybody ever see something like this before, or have ideas what might help? I'm running out of ideas.


Screen shot: http://www.dehacked.net/shot0001.jpg size 212 kb
Short clip of output: http://www.dehacked.net/frasier-failure.ts size 2750 kb

More information about the Libav-user mailing list