ffmpeg将sdp转发,使用SDP将RTP流传输到FFMPEG

博主尝试使用ffmpeg将从WebRTC服务器获取的RTP流通过SDP文件转发并保存为文件或推送到其他媒体服务器。遇到ffmpeg尝试打开SDP文件时设置的音频和视频流失败的问题,包括UDP端口占用和TCP连接未建立等错误。尝试了两种方法(UDP和TCP)但都未能成功。寻求关于SDP文件格式和端口设置的建议,同时欢迎提供替代SDP的解决方案。
摘要由CSDN通过智能技术生成

I get RTP stream from WebRTC server (I used mediasoup) using node.js and I get the decrypted RTP packets raw data from the stream.

I want to forward this RTP data to ffmpeg and from there I can save it to file, or push it as RTMP stream to other media servers.

I guess that the best way would be to create SDP file that describes both the audio and video streams and send the packets therough new sockets.

The ffmpeg command is:

ffmpeg -loglevel debug -protocol_whitelist file,crypto,udp,rtp -re -vcodec libvpx -acodec opus -i test.sdp -vcodec libx264 -acodec aac -y output.mp4

I tried to send the packets through UDP:

v=0

o=mediasoup 7199daf55e496b370e36cd1d25b1ef5b9dff6858 0 IN IP4 192.168.193.182

s=7199daf55e496b370e36cd1d25b1ef5b9dff6858

c=IN IP4 192.168.193.182

t=0 0

m=audio 33301 RTP/AVP 111

a=rtpmap:111 /opus/48000

a=fmtp:111 minptime=10;useinbandfec=1

a=rtcp-fb:111 transport-cc

a=sendrecv

m=video 33302 RTP/AVP 100

a=rtpmap:100 /VP8/90000

a=rtcp-fb:100 ccm fir

a=rtcp-fb:100 nack

a=rtcp-fb:100 nack pli

a=rtcp-fb:100 goog-remb

a=rtcp-fb:100 transport-cc

a=sendrecv

But I always get (removed the boring parts):

Opening an input file: test.sdp.

[sdp @ 0x103dea0]

Format sdp probed with size=2048 and score=50

[sdp @ 0x103dea0] audio codec set to: (null)

[sdp @ 0x103dea0] audio samplerate set to: 44100

[sdp @ 0x103dea0] audio channels set to: 1

[sdp @ 0x103dea0] video codec set to: (null)

[udp @ 0x10402e0] end receive buffer size reported is 131072

[udp @

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值