I am using libx264 compiled from source. It was configured to get both libx264.dll and libx264.lib by this command
I am using the libx264 API in my screen-sharing program with the preset - "veryfast", tune - "zerolatency", profile - "high" and also the following settings.Code:./configure --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def`
For these settings the program works fine. I specified it as single threaded by setting param.i_threads = 1. If that is removed, x264 will default to using multiple threads and sets param.i_threads as 1.5x of number of cores in the CPU automatically. This will give faster performance than running in single thread.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 final output stream is fully grey. The program works without any errors but I cannot see any output when I view the stream with VLC as it is grey.
This is the code in which I am streaming the encoded data. This is using the srs librtmp library. There is no error in this code but the stream has no output.
Please tell me what is causing this problem when multi-threading is enabled. Am I setting wrong values? Is the code in which I am streaming the encoded data wrong? It works in single thread so it should also work in multiple threads. But it is not working. What is wrong here?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; } }
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 1 of 1
Thread
Similar Threads
-
Add mp4 output on x264 compile
By naoto89 in forum Newbie / General discussionsReplies: 17Last Post: 9th Jul 2020, 16:56 -
Correct color output for DVDR-VHS to x264 conversion
By mrwhitethc in forum Video ConversionReplies: 19Last Post: 18th Feb 2020, 21:10 -
DVDFab Nvidea CUDA GPU Acceleration not enabled on video xfer DVD's
By videobruce in forum DVD RippingReplies: 5Last Post: 21st Aug 2019, 05:37 -
Testing effects of CPU multi-threading on x264 encoding
By ziggy1971 in forum Video ConversionReplies: 49Last Post: 5th Mar 2019, 10:05 -
The Hardware Video recorder option must be enabled? Powerdirector 10
By jbitakis in forum Video ConversionReplies: 0Last Post: 28th Dec 2016, 15:26