Streaming 使用gstreamer组合音频和视频流

Streaming 使用gstreamer组合音频和视频流,streaming,video-streaming,gstreamer,rtp,audio-video-sync,Streaming,Video Streaming,Gstreamer,Rtp,Audio Video Sync,我使用gstreamer over RTP流将mp4(mpeg-4)文件从一个设备传输到另一个设备。基本上,我将mp4文件分解为音频和视频文件,然后将其全部发送到另一个设备,在那里进行流式传输。现在,我想将mp4文件保存到另一台设备的磁盘上,但我的问题是,我可以单独保存音频和视频文件,并且不能单独播放 我对如何将音频和视频rtp流结合起来形成mp4文件并将其保存到另一个设备中的文件感到困惑 以下是命令行代码: 发送方(服务器) gst-launch-0.10 -v filesrc locatio

我使用gstreamer over RTP流将mp4(mpeg-4)文件从一个设备传输到另一个设备。基本上,我将mp4文件分解为音频和视频文件,然后将其全部发送到另一个设备,在那里进行流式传输。现在,我想将mp4文件保存到另一台设备的磁盘上,但我的问题是,我可以单独保存音频和视频文件,并且不能单独播放

我对如何将音频和视频rtp流结合起来形成mp4文件并将其保存到另一个设备中的文件感到困惑

以下是命令行代码:

发送方(服务器)

gst-launch-0.10 -v filesrc location=/home/kuber/Desktop/sample.mp4 \
             ! qtdemux name=d \
             ! queue \
             ! rtpmp4vpay \
             ! udpsink port=5000 \
             d. \
             ! queue \
             ! rtpmp4gpay \
             ! udpsink port=5002
gst-launch-0.10 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)243, config=(string)000001b0f3000001b50ee040c0cf0000010000000120008440fa282fa0f0a21f, payload=(int)96, ssrc=(uint)4291479415, clock-base=(uint)4002140493, seqnum-base=(uint)57180" \
             ! rtpmp4vdepay \
             ! ffdec_mpeg4 \
             ! xvimagesink sync=false \
             udpsrc port=5002 caps="application/x-rtp, media=(string)audio, clock-rate=(int)32000, encoding-name=(string)MPEG4-GENERIC, encoding-params=(string)2, streamtype=(string)5, profile-level-id=(string)2, mode=(string)AAC-hbr, config=(string)1290, sizelength=(string)13, indexlength=(string)3, indexdeltalength=(string)3, payload=(int)96, ssrc=(uint)501975200, clock-base=(uint)4248495069, seqnum-base=(uint)37039"\
             ! rtpmp4gdepay \
             ! faad \
             ! alsasink sync=false
接收器(客户端)

gst-launch-0.10 -v filesrc location=/home/kuber/Desktop/sample.mp4 \
             ! qtdemux name=d \
             ! queue \
             ! rtpmp4vpay \
             ! udpsink port=5000 \
             d. \
             ! queue \
             ! rtpmp4gpay \
             ! udpsink port=5002
gst-launch-0.10 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)243, config=(string)000001b0f3000001b50ee040c0cf0000010000000120008440fa282fa0f0a21f, payload=(int)96, ssrc=(uint)4291479415, clock-base=(uint)4002140493, seqnum-base=(uint)57180" \
             ! rtpmp4vdepay \
             ! ffdec_mpeg4 \
             ! xvimagesink sync=false \
             udpsrc port=5002 caps="application/x-rtp, media=(string)audio, clock-rate=(int)32000, encoding-name=(string)MPEG4-GENERIC, encoding-params=(string)2, streamtype=(string)5, profile-level-id=(string)2, mode=(string)AAC-hbr, config=(string)1290, sizelength=(string)13, indexlength=(string)3, indexdeltalength=(string)3, payload=(int)96, ssrc=(uint)501975200, clock-base=(uint)4248495069, seqnum-base=(uint)37039"\
             ! rtpmp4gdepay \
             ! faad \
             ! alsasink sync=false

您可以尝试使用以下管道将音频和视频多路复用到单个文件中。 这方面的管道如下所示:

gst-launch-0.10 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP4V-ES, profile-level-id=(string)243, config=(string)000001b0f3000001b50ee040c0cf0000010000000120008440fa282fa0f0a21f, payload=(int)96, ssrc=(uint)4291479415, clock-base=(uint)4002140493, seqnum-base=(uint)57180" \
             ! rtpmp4vdepay \
             ! ffdec_mpeg4 \
             ! mux. \
         udpsrc port=5002 caps="application/x-rtp, media=(string)audio, clock-rate=(int)32000, encoding-name=(string)MPEG4-GENERIC, encoding-params=(string)2, streamtype=(string)5, profile-level-id=(string)2, mode=(string)AAC-hbr, config=(string)1290, sizelength=(string)13, indexlength=(string)3, indexdeltalength=(string)3, payload=(int)96, ssrc=(uint)501975200, clock-base=(uint)4248495069, seqnum-base=(uint)37039"\
             ! rtpmp4gdepay \
             ! faad \
             ! mux. 
         matroskamux name=mux 
             ! filesink location=video.mp4 

我想到的一个解决方案是删除接收器和发送器中的编码器,即:rtpmp4gpay、rtpmp4gdepay和faad。这将导致音频和视频文件流化,而不是编码流,然后在接收器中使用qtmux合并音频和视频流,但我发现qtmux与udpsrc不兼容的错误。我到底应该在哪里进行更改?gst-launch-0.10 udpsrc port=5000 caps=“应用程序/x-rtp,媒体=(字符串)视频,时钟速率=(int)90000,编码名称=(字符串)MP4V-ES,配置文件级别id=(字符串)243,配置=(字符串)000001B0F3000001B50EE040C0CF0000010000000000120008440FA282FA0F0A21F,有效负载=(int)96,ssrc=(uint)4291479415,时钟基数=(uint)4002140493,亮片基片=(片)57180“!rtpmp4vdepay!队列qtmux name=muxer udpsrc port=5002 caps=“应用程序/x-rtp,媒体=(字符串)音频,时钟速率=(int)32000,编码名称=(字符串)MPEG4-GENERIC,编码参数=(字符串)2,流类型=(字符串)5,配置文件级别id=(字符串)2,模式=(字符串)AAC hbr,配置=(字符串)1290,大小长度=(字符串)13,索引长度=(字符串)3,索引长度=(字符串)3,有效负载=(int)96,ssrc=(uint)501975200,时钟基=(uint)4248495069,seqnum基=(uint)37039“!rtpmp4gdepay!队列穆克瑟。穆克瑟!队列filesink location=/home/Desktop/finaldemo.mp4So im使用上述命令,但它现在显示内部数据流错误?我无法从此syntex构建管道