How to get the audio and video from a WebRTC stream using ffmpeg on server

被刻印的时光 ゝ 提交于 2020-06-10 04:32:06

问题


I am trying to get the audio and video from a WebRTC stream and handle it (transcode or dump) with ffmpeg on ubuntu server. I have naively expected it to simply interpret the sdp offered by WebRTC, but was mistaken. I suspect ffmpeg is not capable of signaling back the answer sdp and it is must be done manually. Here is an offer sdp:

v=0
o=Mozilla-SIPUA-33.1 3662 0 IN IP4 0.0.0.0
s=SIP Call
t=0 0
a=ice-ufrag:5e0a74d1
a=ice-pwd:7446c0eb445117d0018ca2afc5f3ca54
a=fingerprint:sha-256 76:1B:19:CE:3F:41:C5:4D:64:E6:FD:72:D2:FC:42:E1:98:D4:0F:2B:73:AE:C7:F4:2C:73:2C:E7:9E:DC:6A:EB
m=audio 23063 RTP/SAVPF 109 0 8 101
c=IN IP4 188.253.146.208
a=rtpmap:109 opus/48000/2
a=ptime:20
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=setup:actpass
a=candidate:0 1 UDP 2128609535 192.168.1.100 4130 typ host
a=candidate:1 1 UDP 1692467199 188.253.146.208 23063 typ srflx raddr 192.168.1.100 rport 4130
a=candidate:0 2 UDP 2128609534 192.168.1.100 4131 typ host
a=candidate:1 2 UDP 1692467198 188.253.146.208 23064 typ srflx raddr 192.168.1.100 rport 4131
a=rtcp-mux
m=video 23065 RTP/SAVPF 120 126 97
c=IN IP4 188.253.146.208
a=rtpmap:120 VP8/90000
a=rtpmap:126 H264/90000
a=fmtp:126 profile-level-id=42e01f;packetization-mode=1
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=42e01f
a=sendrecv
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
a=setup:actpass
a=candidate:0 1 UDP 2128609535 192.168.1.100 4132 typ host
a=candidate:1 1 UDP 1692467199 188.253.146.208 23065 typ srflx raddr 192.168.1.100 rport 4132
a=candidate:0 2 UDP 2128609534 192.168.1.100 4133 typ host
a=candidate:1 2 UDP 1692467198 188.253.146.208 23066 typ srflx raddr 192.168.1.100 rport 4133
a=rtcp-mux

Is anybody have succeeded in it? Thanks.


回答1:


Not possible without "something" in between the stream source (peer) and ffmpeg; until and unless ffmpeg starts working with DTLS and you know the hash information for the peer (obviously this could be in the SDP). So in summary, ffmpeg would need DTLS and ICE support. An alternative would be to use GStreamer with plugins.



来源:https://stackoverflow.com/questions/27171080/how-to-get-the-audio-and-video-from-a-webrtc-stream-using-ffmpeg-on-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!