udp - 通过 UDP 流式传输 .ts 文件

标签 udp streaming gstreamer mpeg

我想通过 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?

这个警告是什么意思?以及如何解决? 如何解决这个问题?我怎样才能减慢流量?

最佳答案

首先 - 我觉得 pipe 不错..

来自您的更新:

好吧,它看起来像我预期的那样,它是一次性的(正如你已经说过的),问题是在你的原始流中,帧内没有时间信息(那是没有 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 - 通过 UDP 流式传输 .ts 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37202834/

相关文章:

c - Gstreamer 中的图片幻灯片

linux - UDP接收程序优先级?

ios - HTTP 直播是否支持倒带?

sockets - 捕获Web Audio API数据以进行套接字编程

python - 如何使用 Django 流式传输 HttpResponse

java - 我可以在 Applet 中使用 vlcj 库吗?

c - 为什么我的 GStreamer 应用程序的查找事件失败?

udp - 使用 gstreamer 1.0 通过 UDP 将网络摄像头视频流式传输到 PC

python - python中UDP服务器解析JSON对象的数据结构

c++ - boost::asio 加入了错误的接口(interface)