[FFmpeg-user] Synchronize video and audio from SDP file

Jonathan Kanarek Jonathan.Kanarek at kaltura.com
Mon Mar 27 13:31:03 EEST 2017


Hi,
I have RTP packets in node.js server and I want to forward them to ffmpeg.
I generate SDP files in the node.js server side and execute ffmpeg with the SDP as input.
SDP:

v=0
o=mediasoup 579ba7f3ba8b38632222e85adc6a8b7bed13aae9 0 IN IP4 192.168.193.182
s=579ba7f3ba8b38632222e85adc6a8b7bed13aae9
c=IN IP4 192.168.193.182
t=0 0
a=group:LS video audio
m=audio 33402 RTP/AVP 111
a=rtpmap:111 opus/48000
a=fmtp:111 minptime=10;useinbandfec=1
a=rtcp-fb:111 transport-cc
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=mid:audio
a=sendrecv
m=video 33404 RTP/AVP 107
a=rtpmap:107 H264/90000
a=fmtp:107 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtcp-fb:107 ccm fir
a=rtcp-fb:107 nack
a=rtcp-fb:107 nack pli
a=rtcp-fb:107 goog-remb
a=rtcp-fb:107 transport-cc
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 urn:3gpp:video-orientation
a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=mid:video
a=sendrecv

Command:
ffmpeg -max_delay 5000 -reorder_queue_size 16384 -protocol_whitelist file,crypto,udp,rtp -re -i input.sdp -vcodec copy -acodec aac -y output.mp4

I weird video that plays at each frame either the video or the audio but never both of them together.

BTW, when I create separate SDP files for the video and the audio and stream them as two inputs into the same output, I get valid stream but the audio is not in sync (about a second offset).
ffmpeg -max_delay 5000 -reorder_queue_size 16384 -protocol_whitelist file,crypto,udp,rtp -re -i video.0.sdp -max_delay 5000 -reorder_queue_size 16384 -protocol_whitelist file,crypto,udp,rtp -re -i audio.1.sdp -vcodec copy -acodec aac -shortest -y output.mp4

What is wrong with my SDP?

Thanks,
Johnathan Kanarek


More information about the ffmpeg-user mailing list