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

Soner CAN soner2 at gmail.com
Thu Sep 4 20:05:03 CEST 2014


Hello there,

Firstly, here is my command (a more colorful view exists here
<http://pastebin.com/NvVpVfYA>):

ffmpeg -y -i  udp://172.16.11.111:2011  -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


More information about the ffmpeg-user mailing list