[x264-devel] x264 encoding hangs randomly

Dmitry Q linuxsquirrel.dev at gmail.com
Thu Aug 6 13:32:42 CEST 2015


Hi. I've compiled x264 from master on Windows 7 with mingw 4.8.2 POSIX
threading, DWARF exceptions (from here:
https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting
Win32/Personal Builds/mingw-builds/4.8.2). I've wrote a small application
to grab the screen contents and encode it with x264. The screen itself
displays a live metal concert, so the bitrate is rather high. I see
that x264_encoder_encode()
hangs randomly. Pseudo code:

while(true)
{
    print "Grabbing"
    grab screen

    print "Converting"
    convert to YUV

    print "Encoding"
    x264_encoder_encode()
}

So I see something like that:

Grabbing
Converting
Encoding
Grabbing
Converting
Encoding
<nothing, the application in hanged up>

The hang may happen in 1 minute, or in 3 minutes, or in 5 minutes, it's
completely random.

Parameters I use:

param.i_log_level = X264_LOG_DEBUG;
param.i_threads = 8; // Number of my CPU cores
param.i_csp = X264_CSP_I420;
param.i_keyint_max = param.i_fps_num * 5;
param.i_width  = ...; // screen width
param.i_height = ...; // screen height
param.b_vfr_input = 0;
param.b_repeat_headers = 1;
param.b_annexb = 1;

I've tried to debug this with adding debug messages into x264, but the hang
occurs in different places. It looks like the common place in all hangs is
threading. For example, last hang occured in encode.c at line 3094 here:

        if( x264_stack_align( x264_slice_write, h ) ) // <===
            goto fail;


Any ideas how tot fix/debug this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20150806/21cb01ef/attachment.html>


More information about the x264-devel mailing list