简体   繁体   English

GStreamer rtp 流到 vlc

[英]GStreamer rtp stream to vlc

I'm having some trouble figuring out how to create a simple rtp stream with gstreamer and display it on vlc.我在弄清楚如何使用 gstreamer 创建一个简单的 rtp 流并将其显示在 vlc 上时遇到了一些麻烦。

I've installed GStreamer 0.10.30 and VLC 1.1.3.我已经安装了 GStreamer 0.10.30 和 VLC 1.1.3。 My only requirement is to use MPEG4 or H.264 codecs.我唯一的要求是使用 MPEG4 或 H.264 编解码器。

Right now, I can stream the GStreamer videotestsrc through this simple pipeline:现在,我可以通过这个简单的管道流式传输 GStreamer videotestsrc

gst-launch videotestsrc ! ffenc_mpeg4 ! rtpmp4vpay ! udpsink host=127.0.0.1 port=5000

which outputs the "caps" needed by the client to receive the stream:它输出客户端接收流所需的“上限”:

/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)1, config=(string)000001b001000001b58913000001000000012000c48d8800f50a041e1463000001b24c61766335322e3132332e30, payload=(int)96, ssrc=(uint)365697461, clock-base=(uint)390754204, seqnum-base=(uint)10399

I'm also able to display the stream using the following pipeline:我还可以使用以下管道显示流:

gst-launch udpsrc uri=udp://127.0.0.1:5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)1, config=(string)000001b001000001b58913000001000000012000c48d88007d0a041e1463000001b24c61766335322e3132332e30, payload=(int)96, ssrc=(uint)298758266, clock-base=(uint)3097828288, seqnum-base=(uint)63478" ! rtpmp4vdepay ! ffdec_mpeg4 ! autovideosink

but when I try to receive the stream with vlc:但是当我尝试使用 vlc 接收流时:

vlc -vvv rtp://127.0.0.1:5000

I get nothing...我什么都得不到...

I've solved the issue, it just needs an sdp file like this: 我已经解决了这个问题,它只需要一个像这样的sdp文件:

v=0
m=video 5000 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 MP4V-ES/90000

and the option "send-config=true" for the rtpmp4vpay element: 和rtpmp4vpay元素的选项“send-config = true”:

gst-launch videotestsrc ! ffenc_mpeg4 ! rtpmp4vpay send-config=true ! udpsink host=127.0.0.1 port=5000

and then, it can be played with 然后,它可以播放

vlc <filename>.sdp

How to for H264 and new gstreamer (windows) 如何为H264和新gstreamer(窗口)

gst-launch-1.0 videotestsrc ! openh264enc ! rtph264pay config-interval=10 pt=96 ! udpsink host=127.0.0.1 port=5000

sdp file: sdp文件:

v=0
m=video 5000 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 H264/90000

for other codec see https://en.wikipedia.org/wiki/RTP_audio_video_profile and corresponding SDP example in RFC link 其他编解码器请参阅https://en.wikipedia.org/wiki/RTP_audio_video_profile以及RFC链接中相应的SDP示例

For some of you just check the answers, but not comments below the answers对于你们中的一些人,只需检查答案,而不是答案下方的评论

For GStreamer 1.18.xxx.对于 GStreamer 1.18.xxx。 ffenc_mpeg4 was renamed to avenc_mpeg4(This confuses me alot) So try command: ffenc_mpeg4 被重命名为 avenc_mpeg4(这让我很困惑)所以尝试命令:

gst-launch-1.0 videotestsrc ! avenc_mpeg4 ! rtpmp4vpay config-interval=1 ! udpsink host=127.0.0.1 port=5000

About VLC same as Dave's answer关于 VLC 与戴夫的回答相同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM