Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Jun 2020
Posts: 1
|
x264 output video is blank when threading is enabled
I am using libx264 compiled from source. It was configured to get both libx264.dll and libx264.lib by this command
Code:
./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def Code:
param.i_csp = X264_CSP_BGRA;
param.i_threads = 1;
param.i_width = width;
param.i_height = height;
param.i_fps_num = fps;
param.i_fps_den = 1;
param.rc.i_bitrate = bitrate;
param.rc.i_rc_method = X264_RC_ABR;
param.rc.b_filler = true;
param.rc.f_rf_constant = (float)0;
param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;
param.rc.i_vbv_buffer_size = param.rc.i_bitrate;
param.b_repeat_headers = 0;
param.b_annexb = 1;
But when I remove the param.i_threads = 1 to make it multi-threaded, the output video stream is fully grey. The program works without errors and the encoding time is also faster but I cannot see any output when I view the stream with VLC as its fully grey. This is the code in which I am streaming the encoded data. This is using the srs librtmp library. There is no error but the stream is showing no output. Code:
for (int j = 0; j < encoder.nal_count; j++)
{
x264_nal_t* nal = encoder.nals + j;
ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast<char*>(nal->p_payload), nal->i_payload, dts, dts);
ret = check_return_value(ret);
if (!ret)
{
return -1;
}
}
OS - Windows 10 CPU - AMD Ryzen 2600 RAM - 16 GB |
|
|
|
![]() |
| Tags |
| c++, libx264, multi-threading, x264 |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|