[FFmpeg-user] Multiple RTMP outputs from a piped source

Cem İbrahim ARI artdusunce at gmail.com
Thu Sep 4 20:39:30 CEST 2014

For different profiles, your approach seems ok in my opinion. For same
profiles, (ex: 480x270) you can use one input, for sending multiple
outputs. (Just add -f flv BACKUPURL for primary source). If realtime is not
important, or some delays, you can save as file, and re encode to rtmp
then, thats more effective, when your "UDP" source might have packet loss,
bad encoding..etc which will break ffmpeg proccess.
One proccess (ffmpeg command) can do all those piped commands works, but
the reason i mentioned, i advice you to keep  proccesses seperated like you

Cem İbrahim ARI
http://www.creativeblack.net | http://twitter.com/cemibrahimari

On Thu, Sep 4, 2014 at 9:05 PM, Soner CAN <soner2 at gmail.com> wrote:

> Hello there,
> Firstly, here is my command (a more colorful view exists here
> <http://pastebin.com/NvVpVfYA>):
> ffmpeg -y -i  udp://  -pix_fmt yuv420p -c:a libfdk_aac
> > -c:v libx264 -b:v 5000k  -aspect 16:9 -ar 44100 -b:a 48k -ac 1 -vf
> > crop=in_w-2*16:in_h-2*18 -f flv - | ffmpeg -re -f flv -i -
> >  -c:a copy -c:v libx264 -b:v 665k -s 640x360 -force_key_frames
> > "expr:gte(t,n_forced*2)" -f flv "rtmp://
> > xx:yy at PRIMARY.i.akamaientrypoint.net/EntryPoint/zzzz_360 at 11111"
> > -c:a copy -c:v libx264 -b:v 412k -s 480x270 -force_key_frames
> > "expr:gte(t,n_forced*2)" -f flv "rtmp://
> > xx:yy at PRIMARY.i.akamaientrypoint.net/EntryPoint/zzzz_270 at 11111"
> > -c:a copy -c:v libx264 -b:v 158k -s 320x180 -force_key_frames
> > "expr:gte(t,n_forced*2)" -f flv "rtmp://
> > xx:yy at PRIMARY.i.akamaientrypoint.net/EntryPoint/zzzz_180 at 11111"
> > -c:a copy -c:v libx264 -b:v 665k -s 640x360 -force_key_frames
> > "expr:gte(t,n_forced*2)" -f flv "rtmp://
> > xx:yy at BACKUP.i.akamaientrypoint.net/EntryPoint/zzzz_360 at 11111"
> > -c:a copy -c:v libx264 -b:v 412k -s 480x270 -force_key_frames
> > "expr:gte(t,n_forced*2)" -f flv "rtmp://
> > xx:yy at BACKUP.i.akamaientrypoint.net/EntryPoint/zzzz_270 at 11111"
> > -c:a copy -c:v libx264 -b:v 158k -s 320x180 -force_key_frames
> > "expr:gte(t,n_forced*2)" -f flv "rtmp://
> > xx:yy at BACKUP.i.akamaientrypoint.net/EntryPoint/zzzz_180 at 11111"
> I'm sending a UDP stream to 2 different entry points: First one is PRIMARY
> and second on is BACKUP. The command I'm using is above. Nevertheless I
> think that this command may be way more optimized?
> 1. Is my piping strategy something acceptable? Because some of my
> colleagues claim that "using pipe is a bad practice". If it's bad, any
> better options?
> 2. Is there a way to send a "-" output without encoding it EACH time
> sending to a different entry point? I think with an optimized command,
> ffmpeg should transcode each profile (there are 180p, 270p and 360p) only
> ONCE. Because currently it's encoding the source even for BACKUP. However
> it previously encodes video for PRIMARY entry point.
> Thank you in advence!
> Soner CAN
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

More information about the ffmpeg-user mailing list