使用 GStreamer 的视频流应用程序的要求
我想创建一个使用 GStreamer 通过无线传输视频的应用程序。 我的要求是: H.264 编解码器、RTP/MPEG2-TS 流和网络上的 RTP 协议。
任何人都可以解释一下我需要为此创建任何插件或现有插件可以提供所有功能吗?如果是,那么我应该使用哪些插件? 我想补充一点,我将使用电话捕获视频并通过网络从该设备传输到一个或多个特定地址。 请回复 。 提前致谢。
I would like create an application for streaming video over wireless using GStreamer.
My requirements are:
H.264 Codec,RTP/MPEG2-TS stream and RTP protocol over network.
Could any one please explain that I need to create any plugin for that or existing plugins can provide all the functionalities? If yes then what are the plugins I should use?
I would like to add one more point that I will capture the video using a phone and transmit from that device over the network to one or more specific addresses.
Please reply .
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
考虑 RTP(根据需要更改主机/IP)以下管道应该有所帮助。根据您的要求,您可以将
ffenc_mpeg4
替换为x264enc pass=qual quantizer=20 tune=zerolatency
,将rtpmp4vpay
替换为rtph264pay
>。同样,在解码器端,您可以将ffdec_mpeg4
替换为x264dec
,将rtpmp4vdepay
替换为rtph264depay
。可能还需要调整一些其他事情。1) RTP 发送摄像头和音频
gst-launch gstrtpbin name=rtpbin Latency=0 v4l2src device=/dev/video0 !打字查找! ffmpeg颜色空间!视频尺度!视频/x-raw-yuv,宽度=640,高度=480!视频率!视频/x-raw-yuv,帧率=30/1! ffenc_mpeg4! rtpmp4vpay 发送配置=true ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! udpsink 端口=5502 主机=127.0.0.1 rtpbin.send_rtcp_src_0 ! udpsink 端口 = 5510 主机 = 127.0.0.1 同步 = false 异步 = false udpsrc 端口 = 5510 ! rtpbin.recv_rtcp_sink_0 autoaudiosrcsamplesperbuffer=1000!阿拉温克! rtppcma支付! rtpbin.send_rtp_sink_1 rtpbin.send_rtp_src_1! udpsink 端口=5504 主机=127.0.0.1 rtpbin.send_rtcp_src_1 ! udpsink 端口 = 5512 主机 = 127.0.0.1 同步 = false 异步 = false udpsrc 端口 = 5512 ! rtpbin.recv_rtcp_sink_1
2) RTP接收网络摄像头和音频
gst-launch gstrtpbin name=rtpbin2 Latency=0 udpsrc caps="application/x-rtp, media=(string)video,clock-rate=(int )90000,编码名称=(字符串)MP4V-ES,配置文件级别ID =(字符串)1“端口= 5502! rtpbin2.recv_rtp_sink_0 rtpbin2。 ! rtpmp4v支付! ffdec_mpeg4!视频尺度!视频/x-raw-yuv,宽度=640,高度=480!视频率!视频/x-raw-yuv,帧率=30/1! ffmpeg颜色空间! autovideosink udpsrc 端口=5510 ! rtpbin2.recv_rtcp_sink_0 rtpbin2.send_rtcp_src_0! udpsink主机= 127.0.0.1端口= 5510同步=假异步=假udpsrc caps =“应用程序/ x-rtp,媒体=(字符串)音频,时钟速率=(int)8000,编码名称=(字符串)PCMA”端口=5504! rtpbin2.recv_rtp_sink_1 rtpbin2。 ! rtppcmadepay !阿拉法德! autoaudiosink 缓冲时间=10000 udpsrc 端口=5512 ! rtpbin2.recv_rtcp_sink_1 rtpbin2.send_rtcp_src_1! udpsink主机=127.0.0.1端口=5512同步=假异步=假
Considering RTP (change host/ip as required) the following pipelines should help. As per your requirement you may replace
ffenc_mpeg4
withx264enc pass=qual quantizer=20 tune=zerolatency
,rtpmp4vpay
withrtph264pay
. Similarly on decoder side you may replaceffdec_mpeg4
withx264dec
,rtpmp4vdepay
withrtph264depay
. Few other things may also be needed to be tweaked.1) RTP send webcam and audio
gst-launch gstrtpbin name=rtpbin latency=0 v4l2src device=/dev/video0 ! typefind ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv, width=640, height=480 ! videorate ! video/x-raw-yuv, framerate=30/1 ! ffenc_mpeg4 ! rtpmp4vpay send-config=true ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! udpsink port=5502 host=127.0.0.1 rtpbin.send_rtcp_src_0 ! udpsink port=5510 host=127.0.0.1 sync=false async=false udpsrc port=5510 ! rtpbin.recv_rtcp_sink_0 autoaudiosrc samplesperbuffer=1000 ! alawenc ! rtppcmapay ! rtpbin.send_rtp_sink_1 rtpbin.send_rtp_src_1 ! udpsink port=5504 host=127.0.0.1 rtpbin.send_rtcp_src_1 ! udpsink port=5512 host=127.0.0.1 sync=false async=false udpsrc port=5512 ! rtpbin.recv_rtcp_sink_1
2) RTP receive webcam and audio
gst-launch gstrtpbin name=rtpbin2 latency=0 udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)1" port=5502 ! rtpbin2.recv_rtp_sink_0 rtpbin2. ! rtpmp4vdepay ! ffdec_mpeg4 ! videoscale ! video/x-raw-yuv, width=640, height=480 ! videorate ! video/x-raw-yuv, framerate=30/1 ! ffmpegcolorspace ! autovideosink udpsrc port=5510 ! rtpbin2.recv_rtcp_sink_0 rtpbin2.send_rtcp_src_0 ! udpsink host=127.0.0.1 port=5510 sync=false async=false udpsrc caps="application/x-rtp,media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMA" port=5504 ! rtpbin2.recv_rtp_sink_1 rtpbin2. ! rtppcmadepay ! alawdec ! autoaudiosink buffer-time=10000 udpsrc port=5512 ! rtpbin2.recv_rtcp_sink_1 rtpbin2.send_rtcp_src_1 ! udpsink host=127.0.0.1 port=5512 sync=false async=false
gstrtpbin 应该可以满足您的所有流媒体需求。它将允许您将 RTP 流传输到一个或多个地址。有关如何使用它的说明,请参阅 gstreamer 源代码< /a> 有几个不同语言的示例。 Gstreamer 还允许您使用 x264 将视频编码为 H.264 流。这是包含在“丑陋”的插件包中的。
The gstrtpbin should handle all of your streaming needs. It will allow you to transmit an RTP stream to one or more addresses. For instruction on how to use it, the gstreamer source code has several examples in a few different languages. Gstreamer will also allow you to encode the video into an H.264 stream using the x264. This is included in the "ugly" plug-ins package.