create 4 RTP streams (H264/AAC) from a single source with a single ffmpeg instance...

ffmpeg -i $src -an -vcodec [...details in description...] rtp rtp://$dstIP:$dstAudioPort4 -newaudio
ffmpeg [source specification if needed] -i $src -an -vcodec libx264 -coder 0 -threads 0 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -level 13 -g 15 -crf 25 -s 320x224 -aspect 16:9 -r 15 -b 186000 -vb 186000 -minrate 176700 -maxrate 195300 -bt 9300 -bufsize 262500 -muxrate 195300 -vglobal 1 -f rtp rtp://$dstIP:$dstVideoPort1 -vn -acodec libfaac -async 2 -flags +global_header -ac 1 -ar 44100 -ab 64000 -f rtp rtp://$dstIP:$dstAudioPort1 -newaudio -an -vcodec libx264 -coder 0 -threads 0 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -level 13 -g 20 -crf 25 -s 320x224 -aspect 16:9 -r 20 -b 286000 -vb 286000 -minrate 271700 -maxrate 300300 -bt 14300 -bufsize 367500 -muxrate 300300 -vglobal 1 -f rtp rtp://$dstIP:$dstVideoPort2 -newvideo -vn -acodec libfaac -async 2 -flags +global_header -ac 1 -ar 44100 -ab 64000 -f rtp rtp://$dstIP:$dstAudioPort2 -newaudio -an -vcodec libx264 -coder 0 -threads 0 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -level 30 -g 25 -crf 25 -s 480x336 -aspect 16:9 -r 25 -b 386000 -vb 386000 -minrate 366700 -maxrate 405300 -bt 19300 -bufsize 472500 -muxrate 405300 -vglobal 1 -f rtp rtp://$dstIP:$dstVideoPort3 -newvideo -vn -acodec libfaac -async 2 -flags +global_header -ac 2 -ar 44100 -ab 64000 -f rtp rtp://$dstIP:$dstAudioPort3 -newaudio -an -vcodec libx264 -coder 0 -threads 0 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -level 30 -g 25 -crf 25 -s 480x336 -aspect 16:9 -r 25 -b 686000 -vb 686000 -minrate 651700 -maxrate 720300 -bt 34300 -bufsize 787500 -muxrate 720300 -vglobal 1 -f rtp rtp://$dstIP:$dstVideoPort4 -newvideo -vn -acodec libfaac -async 2 -flags +global_header -ac 2 -ar 44100 -ab 64000 -f rtp rtp://$dstIP:$dstAudioPort4 -newaudio
Sample Output
[...]
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
t=0 0
a=tool:libavformat 52.39.2
m=video 50002 RTP/AVP 96
c=IN IP4 172.16.99.208
b=AS:186
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LADatAoO3/gBwAFogAAAMACAAAAwD0eKFV,aM4fIA==
m=audio 50004 RTP/AVP 96
c=IN IP4 172.16.99.208
b=AS:64
a=rtpmap:96 MPEG4-GENERIC/44100/1
a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1208
m=video 50006 RTP/AVP 96
c=IN IP4 172.16.99.208
b=AS:286
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LADbkQKDt/4AcABaIAAAMAAgAAAwBRHihVQA==,aM4fIA==
m=audio 50008 RTP/AVP 96
c=IN IP4 172.16.99.208
b=AS:64
a=rtpmap:96 MPEG4-GENERIC/44100/1
a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1208
m=video 50010 RTP/AVP 96
c=IN IP4 172.16.99.208
b=AS:386
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LAHrkQPBXf+AHAAWiAAAADAIAAABlHixdQ,aM4fIA==
m=audio 50012 RTP/AVP 96
c=IN IP4 172.16.99.208
b=AS:64
a=rtpmap:96 MPEG4-GENERIC/44100/2
a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1210
m=video 50014 RTP/AVP 96
c=IN IP4 172.16.99.208
b=AS:686
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LAHrkQPBXf+AHAAWiAAAADAIAAABlHixdQ,aM4fIA==
m=audio 50016 RTP/AVP 96
c=IN IP4 172.16.99.208
b=AS:64
a=rtpmap:96 MPEG4-GENERIC/44100/2
a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1210
[...]

0
2011-07-29 15:36:37

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: