通过 UDP 流式传输 .ts 文件
Streaming .ts File Over UDP
我想通过 udp 传输 .ts 文件,为此我使用了下面的管道。
但一秒钟之内它就达到了 EOS
GST_DEBUG=3 gst-launch-1.0 -v filesrc location=avm.ts ! queue ! tsparse ! rtpmp2tpay ! udpsink host=192.168.1.139 port=8080
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.177011430
在接收端我无法接收到整个数据,只有前几帧是因为发送端的即时退出。
在流式传输包含视频和文本数据的 .ts 文件时,在接收端仅获取文本数据。
在发送端下面来了调试信息。
0:00:00.030345526 7863 0xd9df60 WARN basesrc gstbasesrc.c:3483:gst_base_src_start_complete:<filesrc0> pad not activated yet
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/MpegTsMux:mpegtsmux0.GstPad:sink_65: caps = "application/x-metadata\,\ standard\=\(string\)klv"
0:00:00.031289005 7863 0xd710f0 FIXME basesink gstbasesink.c:3064:gst_base_sink_default_event:<udpsink0> stream-start event without group-id. Consider implementing group-id handling in the upstream elements
当我更改管道并添加标识时,例如,
gst-launch-1.0 filesrc location=vfpd.ts ! queue ! tsparse ! rtpmp2tpay ! identity silent=false ! udpsink -v host=192.168.1.139 port=8765
然后收到太多消息,如下所示,
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf40abac0
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (200 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf40abdf0
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf40db7f0
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf409d450
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf4007460
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (200 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf40bfc10
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf408f000
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf409d560
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (952 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf408f330
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: eos (28174), ) 0x7fcaf4003400
因此,据我了解,它是在单个实例中发送所有数据包,这意味着没有流量控制。
文件为 25 fps。我怎样才能以相同的流量传输 ts?
这个警告是什么意思?以及如何解决?
如何解决这个问题?我怎样才能减慢流量?
我使用了下面的管道,解决了我的问题。
GST_DEBUG=3 gst-launch-1.0 -v filesrc location=avm.ts ! queue ! tsdemux ! mpegtsmux ! rtpmp2tpay ! udpsink host=192.168.1.139 port=8080
首先 - 我觉得烟斗不错..
根据您的更新:
好吧,它看起来像我预期的那样,它是一次性的(正如你已经说过的),问题是在你的原始流中,帧内没有时间信息(那是那些 none for dts, pts 和持续时间).. 有两种可能的解释 - 你的 .ts 文件有问题.. 或者 gstreamer 管道有问题..
我个人认为您的 .ts 文件有误..
为了消除第一个问题,我建议使用一些 mpeg 分析器分析 .ts 文件。
您应该检查 mpeg ts 流是否包含正确的 PCR 值,这些值是 mpeg 流的同步信息。
更新:
好的,经过一点点黑客攻击后,我找到了这个解决方案,我希望它能在接收者站点上运行,我测试只是为了流式传输它,它 运行 的长度与原始 ts file 相同:
gst-launch-1.0 filesrc location=football.ts ! queue ! tsparse set-timestamps=true ! rtpmp2tpay ! udpsink -v host=192.168.1.139 port=8765
set-timestamps
正在使用时间信息正确标记缓冲区..
我想通过 udp 传输 .ts 文件,为此我使用了下面的管道。
但一秒钟之内它就达到了 EOS
GST_DEBUG=3 gst-launch-1.0 -v filesrc location=avm.ts ! queue ! tsparse ! rtpmp2tpay ! udpsink host=192.168.1.139 port=8080
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.177011430
在接收端我无法接收到整个数据,只有前几帧是因为发送端的即时退出。
在流式传输包含视频和文本数据的 .ts 文件时,在接收端仅获取文本数据。
在发送端下面来了调试信息。
0:00:00.030345526 7863 0xd9df60 WARN basesrc gstbasesrc.c:3483:gst_base_src_start_complete:<filesrc0> pad not activated yet
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/MpegTsMux:mpegtsmux0.GstPad:sink_65: caps = "application/x-metadata\,\ standard\=\(string\)klv"
0:00:00.031289005 7863 0xd710f0 FIXME basesink gstbasesink.c:3064:gst_base_sink_default_event:<udpsink0> stream-start event without group-id. Consider implementing group-id handling in the upstream elements
当我更改管道并添加标识时,例如,
gst-launch-1.0 filesrc location=vfpd.ts ! queue ! tsparse ! rtpmp2tpay ! identity silent=false ! udpsink -v host=192.168.1.139 port=8765
然后收到太多消息,如下所示,
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf40abac0
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (200 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf40abdf0
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf40db7f0
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf409d450
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf4007460
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (200 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf40bfc10
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf408f000
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (1328 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf409d560
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (952 bytes, dts: none, pts:none, duration: none, offset: -1, offset_end: -1, flags: 00004000 tag-memory ) 0x7fcaf408f330
/GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: eos (28174), ) 0x7fcaf4003400
因此,据我了解,它是在单个实例中发送所有数据包,这意味着没有流量控制。
文件为 25 fps。我怎样才能以相同的流量传输 ts?
这个警告是什么意思?以及如何解决? 如何解决这个问题?我怎样才能减慢流量?
我使用了下面的管道,解决了我的问题。
GST_DEBUG=3 gst-launch-1.0 -v filesrc location=avm.ts ! queue ! tsdemux ! mpegtsmux ! rtpmp2tpay ! udpsink host=192.168.1.139 port=8080
首先 - 我觉得烟斗不错..
根据您的更新:
好吧,它看起来像我预期的那样,它是一次性的(正如你已经说过的),问题是在你的原始流中,帧内没有时间信息(那是那些 none for dts, pts 和持续时间).. 有两种可能的解释 - 你的 .ts 文件有问题.. 或者 gstreamer 管道有问题..
我个人认为您的 .ts 文件有误..
为了消除第一个问题,我建议使用一些 mpeg 分析器分析 .ts 文件。
您应该检查 mpeg ts 流是否包含正确的 PCR 值,这些值是 mpeg 流的同步信息。
更新:
好的,经过一点点黑客攻击后,我找到了这个解决方案,我希望它能在接收者站点上运行,我测试只是为了流式传输它,它 运行 的长度与原始 ts file 相同:
gst-launch-1.0 filesrc location=football.ts ! queue ! tsparse set-timestamps=true ! rtpmp2tpay ! udpsink -v host=192.168.1.139 port=8765
set-timestamps
正在使用时间信息正确标记缓冲区..