user1447903
user1447903

Reputation: 323

Joining a video stream in ffmpeg by passing an SDP file as inline data

Afternoon. Using ffmpeg I can open an SDP file using the syntax:

ffmpeg -protocol_whitelist file -i file.sdp

Does anyone know if it is possible to join the stream described in the sdp file without first writing the contents to a file?

So, for example, if the SDP file contents is:

v=0
m=video 1234 RTP/AVP 96
c=IN IP4 232.1.2.3
a=rtpmap:96 MP4V-ES/90000
a=source-filter: incl IN IP4 232.1.2.3 1.2.3.4

Can I use the data input type described here: https://ffmpeg.org/ffmpeg-protocols.html#data

To join the same stream doing something like:

ffmpeg -protocol_whitelist data -i "data:application/sdp;charset=UTF-8,v=0 \r\n...."

The answer /seems/ to be no, but I thought I'd ask "the internet" in case I am simply doing something wrong...

Upvotes: 3

Views: 3897

Answers (2)

Petr Šebesta
Petr Šebesta

Reputation: 230

There is a sample how to consume AAC audio stream with ffmpeg by specifying SDP content as argument. Output is formatted as WAV and send to stdout.

-protocol_whitelist data,rtp,udp -i "data:application/sdp;charset=UTF-8,v=0
c=IN IP4 127.0.0.1/64
b=AS:4000
m=audio 1100 RTP/AVP 99
a=rtpmap:99 mpeg4-generic/44100/2
a=fmtp:99 streamtype=5; profile-level-id=15; mode=AAC-hbr; config=121000; 
sizeLength=13; indexLength=3; indexDeltaLength=3"
-y -f wav pipe:1

As line break is used: \n

Upvotes: 3

OldC
OldC

Reputation: 186

You can pipe the SDP file contents to ffmpeg as follow.

printf "SDP:\nv=0\nm=video 1234 RTP/AVP 96\nc=IN IP4 232.1.2.3\na=rtpmap:96 MP4V-ES/90000\na=source-filter: incl IN IP4 232.1.2.3 1.2.3.4\n" | ffmpeg -i - -codec copy output.mp4

Upvotes: 4

Related Questions