[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


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:

 - only video in resolution 640:360 (A)
 - same video in resolution 720:410 (B)
 - 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://@'
-i 'udp://@'
-i 'udp://@'
-i 'udp://@'
-i 'udp://'
-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

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