我正在尝试将 GESPipeline 编码并复用到 MPEG-TS 中,以便通过 UDP 进行流式传输。
管道在预览模式下在屏幕上播放良好。
我的尝试,基本上:
GstEncodingContainerProfile *prof;
GstCaps *caps;
caps = gst_caps_from_string("video/mpegts");
prof = gst_encoding_container_profile_new("test-app-profile", NULL, caps, NULL);
caps = gst_caps_from_string("video/x-h264");
gst_encoding_container_profile_add_profile(prof,
(GstEncodingProfile*) gst_encoding_video_profile_new(caps, NULL, NULL, 0));
caps = gst_caps_from_string("audio/x-ac3");
gst_encoding_container_profile_add_profile(prof,
(GstEncodingProfile*) gst_encoding_audio_profile_new(caps, NULL, NULL, 0));
// this fails:
ges_pipeline_set_render_settings (pl, "file:///path/out.ts", prof);
在 GST_DEBUG=3 的输出中:
encodebin gstencodebin.c:1976:create_elements_and_pads: 错误:没有可用于格式视频/mpegts 的复用器
更新:更详细的调试显示它实际上查看了 mpegtsmux,但跳过了它。为什么?
相关讯息:
gst_encode_bin_setup_profile:设置配置文件 0x557c3c98c460:test-app-profile(类型:容器)
create_elements_and_pads:当前配置文件:test-app-profile
_get_muxer:获取格式视频/mpegts 的多路复用器列表
gst_element_factory_list_filter:查找工厂
...
gst_element_factory_list_filter:尝试 mpegtsmux
gst_structure_parse_field :尝试字段名称'systemstream'
_priv_gst_value_parse_value:尝试类型名称'boolean'
gst_structure_parse_field:尝试字段名称'packetsize'
_priv_gst_value_parse_value:尝试类型名称'int'
...尝试其他复用器...
如果我将 video/mpegts 更改为 video/x-matroska,则会生成 mkv 文件(虽然丑陋且没有声音)。
如何编码成mpeg?