[FFmpeg-user] Processing multiple udp inputs and outputting to multiple mp4 files

Jakub Vojáček jakub at jacon.cz
Thu Apr 5 22:50:45 EEST 2018


Hello,

I have live stream that is running over multiple UDP ip:ports. On each
port, there is different content. For example, there is channel BBC and
runs on:

 - 239.200.200.16:1234 only video in resolution 640:360 (A)
 - 239.200.200.16:1235 same video in resolution 720:410 (B)
 - 239.200.200.16:1255 audio (C)

now we need to capture "event" that lasts for example 10 seconds and
product mp4 files with video A, B and audio C. I have tried command

ffmpeg -i 'udp://@
239.200.200.16:1234?interface=172.16.128.42&fifo_size=100000000&timeout=100000000'
-i 'udp://@
239.200.200.16:1235?interface=172.16.128.42&fifo_size=100000000&timeout=100000000'
-i 'udp://@
239.200.200.16:1236?interface=172.16.128.42&fifo_size=100000000&timeout=100000000'
-i 'udp://@
239.200.200.16:1237?interface=172.16.128.42&fifo_size=100000000&timeout=100000000'
-i 'udp://
239.200.200.16:1255?interface=172.16.128.42&fifo_size=100000000&timeout=100000000'
-map 0:0  -copyinkf -movflags faststart -t 10 -vcodec copy -f mp4
video_640_360.mp4 -map 1:0 -copyinkf -movflags faststart -t 10 -vcodec copy
-f mp4 video_720_410.mp4  -map 4:0  -copyinkf -movflags faststart -t 10
-acodec copy -f mp4 audio_cs.mp4

this creates mp4 files however they are not aligned. When I package this
using packager, the content of the two video profiles are not synchronized
and audio is not matching any of the videos (when profile is changed, the
video jumps few seconds). I think it might be because the ffmpeg first
analyses first input, starts recording, analyses second input, starts
recording, ... and analysing takes some time, therefore its not
synchronized.

I also tried multiple ffmpegs, one for each input (something like
bash ffmpeg xxx & ffmpeg yyy & ffmpeg zzz). I have achieved much better
results than with the first solution but the audio still didnt match video
by a little time (usually 0.5 to 2 secs).

What would you please suggest to do to achieve having multiple video
profiles and audio synchronized from multiple UDP inputs?

Thank you for assistance

Jakub Vojacek


More information about the ffmpeg-user mailing list