Realtime encoding
Posted: 30 Mar 2018 23:18
Hello.
It is necessary to develop software using Videolan library for encoding video data. The main requirement is real-time encoding with good quality.
I used the library https://sourceforge.net/projects/x264vfw/ but on Windows 10 when I close the stream I get an error that can not be fixed.
So. I downloaded the source. collected everything for Visual Studio 2017 C ++.
Running the code from the example, I can not open the encoder.
When I open, I get an error: "x264 [error]: invalid level_idc: 8"
Tell me please, what does this error mean and what is required to start coding in real time?
Sorry for the code. I do not understand why it is displayed without the newline characters.
It is necessary to develop software using Videolan library for encoding video data. The main requirement is real-time encoding with good quality.
I used the library https://sourceforge.net/projects/x264vfw/ but on Windows 10 when I close the stream I get an error that can not be fixed.
So. I downloaded the source. collected everything for Visual Studio 2017 C ++.
Running the code from the example, I can not open the encoder.
When I open, I get an error: "x264 [error]: invalid level_idc: 8"
Tell me please, what does this error mean and what is required to start coding in real time?
Code: Select all
int main()
{
int width, height;
x264_param_t param;
x264_picture_t pic;
x264_picture_t pic_out;
x264_t *h;
int i_frame = 0;
int i_frame_size;
x264_nal_t *nal;
int i_nal;
// тут с параметров задаются высота и ширинакадра
//FAIL_IF_ERROR(!(argc > 1), "Example usage: example 352x288 <input.yuv >output.h264\n");
//FAIL_IF_ERROR(2 != sscanf(argv[1], "%dx%d", &width, &height), "resolution not specified or incorrect\n");
width = 352;
height = 288;
/* Get default params for preset/tuning */
if (x264_param_default_preset(¶m, "medium", NULL) < 0)
goto fail;
/* Configure non-default params */
param.i_bitdepth = 8;
param.i_csp = X264_CSP_I420;
param.i_width = width;
param.i_height = height;
param.b_vfr_input = 0;
param.b_repeat_headers = 1;
param.b_annexb = 1;
/* Apply profile restrictions. */
if (x264_param_apply_profile(¶m, "high") < 0)
goto fail;
if (x264_picture_alloc(&pic, param.i_csp, param.i_width, param.i_height) < 0)
goto fail;
#undef fail
#define fail fail2
h = x264_encoder_open(¶m);
if (!h)
goto fail;
#undef fail
#define fail fail2
h = x264_encoder_open(¶m); <--- Here im getting zero in h and error in console
if (!h)
goto fail;
#undef fail
#define fail fail3
int fgop = 1;
#undef fail
fail3 :
x264_encoder_close(h);
fail2:
x264_picture_clean(&pic);
fail:
return -1;
}
Sorry for the code. I do not understand why it is displayed without the newline characters.