如何使用udp gstreamer流式传输h264 [英] How to stream h264 with udp gstreamer
问题描述
我正在尝试使用h264流式传输视频.源是Axis相机.我设法通过多播而不是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:
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
但是无法正常工作.
以verbos模式运行时,我会得到更多信息.
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..
关于没有元素udpsrc的第一个错误确实很奇怪.但是我认为它抱怨缺少uri参数.您使用的是哪个版本?我没有udpsrc的host参数.
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.
这是什么意思:
但是无法正常工作
But could not get it to work
这并不过分;)
通常,在使用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屋!