如何通过 UDP 流式传输 x264_encoder_encode 的输出?
这是我的 Init_x264 函数:
x264_param_t param;
x264_param_default_preset(¶m, "veryfast", "zerolatency");
param.i_threads = 1;
param.i_width = width;
param.i_height = height;
param.i_fps_num = 30;
param.i_fps_den = 1;
param.i_keyint_max = 30;
param.b_intra_refresh = 1;
param.rc.i_rc_method = X264_RC_CRF;
param.rc.f_rf_constant = 25;
param.rc.f_rf_constant_max = 35;
param.b_annexb = 1;
param.b_repeat_headers = 1;
param.i_log_level = X264_LOG_DEBUG;
x264_param_apply_profile(¶m, "baseline");
encoder = x264_encoder_open(¶m);
picIn = new x264_picture_t;
picOut = new x264_picture_t;
x264_picture_alloc(picIn, X264_CSP_I420, width, height);
x264_encoder_parameters(encoder, ¶m);
现在,我没有将 x264_encoder_encode 的输出保存到磁盘(使用 fwrite),而是尝试通过 UDP 将其发送到我的目的地。我尝试用 avplay 播放它,但它失败了:
[h264 @ 0x7f83f0012e80] non-existing PPS 0 referenced
[h264 @ 0x7f83f0012e80] decode_slice_header error
[h264 @ 0x7f83f0012e80] no frame!
[h264 @ 0x7f83f0012e80] non-existing PPS 0 referenced
[h264 @ 0x7f83f0012e80] decode_slice_header error
[h264 @ 0x7f83f0012e80] no frame!
使用 vlc 我收到了不同的错误消息,主要是关于缺少标题。