如何使用 udp gstreamer 流式传输 h264 [英] How to stream h264 with udp gstreamer

查看:34
本文介绍了如何使用 udp gstreamer 流式传输 h264的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 h264 流式传输视频.源是轴相机.我设法使用多播而不是 h264 流式传输 jpeg.

I'm trying to stream a video with h264. Source is a Axis camera. I managed to stream jpeg with multicast but not h264.

对于 jpeg,我使用了以下命令:

With jpeg I used following command:

gst-launch-1.0 udpsrc uri=udp://239.194.0.177:1026 ! application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! autovideosink

我尝试流式传输 h264 但失败了,使用以下命令:

I tried to stream h264 but it fails, used following command:

gst-launch-1.0 -v udpsrc host=239.194.0.177 port=1026 ! rtph264depay ! ffdec_h264 ! xvimagesink

我收到以下错误:

ERROR: pipeline could not be constructed: no element "udpsrc".

用这一行:

gst-launch-1.0 udpsrc uri=udp://239.194.0.177:1026 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! rtph264depay ! h264parse

我没有收到任何错误,但没有视频流,这是在终端打印的:

I did not get any errors but no video streamed and this was printed in terminal:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

我尝试了以下页面中的命令:

I tried the commands from following pages:

使用 gstreamer 通过 rtp 流式传输 H.264 视频

https://developer.ridgerun.com/wiki/index.php/Using_UDP_Multicast_with_GStreamer

http://labs.isee.biz/index.php/Example_GStreamer_Pipelines#H.264_RTP_Streaming

但无法让它工作.

在详细模式下运行时,我会得到更多信息.

When running in verbos mode I get litte more info.

命令:

gst-launch-1.0 -v udpsrc uri=udp://239.194.0.177:1026 ! application/x-rtp, media=video, payload=96, encoding-name=H264 ! rtph264depay ! avdec_h264 ! videoconvert ! fakesink

输出:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "application/x-rtp, media=(string)video, payload=(int)96, encoding-name=(string)H264, clock-rate=(int)90000"
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = "application/x-rtp, media=(string)video, payload=(int)96, encoding-name=(string)H264, clock-rate=(int)90000"

如何使用 gstreamer 通过多播流式传输 H264?

How do I stream H264 via multicast with gstreamer?

推荐答案

评论太长 - 因为没有人回答,所以发布这个想法草稿作为答案..

Too long for comment - and since nobody is answering posting this draft of thoughts as answer..

关于 no element udpsrc 的第一个错误真的很奇怪.但我认为它抱怨缺少 uri 参数.你用的是什么版本?我没有 udpsrc 的主机参数..

The first error about no element udpsrc is really weird. But I think its complaining about missing uri parameter. What version are you using? I do not have the host parameter for udpsrc..

在第三个管道中,它以 h264parse 结尾 - 这是拼写错误吗?您需要解码 h264 .. 而不仅仅是解析它:

In third pipeline it ends with h264parse - is this s typo? you need to decode the h264.. not just parse it:

gst-launch-1.0 udpsrc uri=udp://239.194.0.177:1026 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink

还可以添加一些运行 GST_DEBUG=3 gst-launch-1.0 .... 左右的日志(如果太长,可能会使用 pastebin).

Also add some logs (maybe with pastebin if too long) with running GST_DEBUG=3 gst-launch-1.0 .... or so.

什么意思:

但无法让它工作

这并没有说太多;)

通常在使用 rtp 时,您需要提供真正的所有功能,否则它可能根本无法链接或播放..

Usually when working with rtp you need to provide really all capabilities otherwise it may not link or play at all..

也许试试 uridecodebin?不确定这是否是最好的主意:

Maybe try with uridecodebin? Not sure if its the best idea:

gst-launch-1.0 uridecodebin uri=udp://etcetc:port ! videoconvert ! autovideosink

如果您收到任何新信息/问题,请将它们添加为更新以使图片完整(对于其他人也是如此..)

If you get any new infos/questions add them as updates to make the picture whole (for others as well..)

HTH

这篇关于如何使用 udp gstreamer 流式传输 h264的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆