[英]Merge Audio and Video pipelines with gstreamer
I have two different pipelines, one for video and one for audio.我有两种不同的管道,一种用于视频,一种用于音频。 They both work independently but i'd like to merge them as a single one.
它们都独立工作,但我想将它们合并为一个。 I believe this is possible but i have no idea how to do such a thing :(
我相信这是可能的,但我不知道如何做这样的事情:(
Here are my two pipelines:这是我的两个管道:
Sender:发件人:
gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=1280,height=720,framerate=10/1' ! ffmpegcolorspace ! vpuenc codec=6 ! rtph264pay ! udpsink host=192.168.20.26 port=5000
gst-launch alsasrc device=hw:2 ! audioconvert ! audioresample ! alawenc ! rtppcmapay ! udpsink host=192.168.20.26 port=5001
Receiver:接收者:
gst-launch udpsrc port=5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, payload=(int)96, encoding-name=(string)H264" ! rtph264depay ! ffdec_h264 ! xvimagesink
gst-launch udpsrc port=5001 caps="application/x-rtp" ! rtppcmadepay ! alawdec ! alsasink
Moreover, anyone knows what would be the resulting sdp file so i can also open it in VLC if needed?此外,任何人都知道生成的 sdp 文件是什么,所以我也可以在需要时在 VLC 中打开它?
Any pointers would be of great help ;)任何指针都会有很大帮助;)
Thank you.谢谢你。
To merge the sender:合并发件人:
gst-launch v4l2src device=/dev/video0 ! \
'video/x-raw-yuv,width=1280,height=720,framerate=10/1' ! \
ffmpegcolorspace ! \
vpuenc codec=6 ! \
rtph264pay ! \
udpsink host=192.168.20.26 port=5000 alsasrc device=hw:2 ! \
audioconvert ! \
audioresample ! \
alawenc ! \
rtppcmapay ! \
udpsink host=192.168.20.26 port=5001
To merge the receiver:合并接收器:
gst-launch udpsrc port=5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, payload=(int)96, encoding-name=(string)H264" ! \
rtph264depay ! \
ffdec_h264 ! \
xvimagesink udpsrc port=5001 caps="application/x-rtp" ! \
rtppcmadepay ! \
alawdec ! \
alsasink
The SDP file would be of the form(generally, this is probably not exact): SDP 文件将采用以下形式(通常,这可能不准确):
v=0
c=IN IP4 <Receiver IP>
m=video 5000 RTP/AVP 96
a=recvonly
a=rtpmap:96 H264/90000
m=audio 5001 RTP/AVP 8
a=recvonly
a=rtpmap:8 PCMA/8000/1
You should change the clock rates on the PCMA if it is two channels.如果是两个通道,您应该更改 PCMA 上的时钟速率。
Also, you MAY need to add a a=fmtp:96 sprop-parameter-sets=<your sprop-parameter sets in the caps>
after the video rtpmap line.此外,您可能需要在视频 rtpmap 行之后添加 a
a=fmtp:96 sprop-parameter-sets=<your sprop-parameter sets in the caps>
。
You should be able to get the full caps for both pipelines by launching it verbosely( gst-launch -v
).您应该能够通过详细启动它来获得两个管道的完整上限(
gst-launch -v
)。 This is so you can get the number of channels and clock-rate for PCMA and your sprop-parameter-sets
for H264.这样您就可以获得 PCMA 的通道数和时钟速率以及 H264 的
sprop-parameter-sets
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.