FFmpeg mosaic

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FFmpeg mosaic

alexdjca
Hi All,

following this help Create Mosaic with FFMPEG i've created a nice mosaic i run to keep a constant eye on a lot of different live streams I've published in my network, and the presence of audio in each of them.

The final code i've built is the following:

ffmpeg -probesize 1M  \
 -i udp://239.98.181.1:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.2:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.3:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.4:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.6:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.7:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.3:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.2:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.4:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.1:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.7:6000?fifo_size=100000?overrun_nonfatal=1 \
 -i udp://239.98.181.2:6000?fifo_size=100000?overrun_nonfatal=1 \
-filter_complex "color=c=black:size=1280x720 [base];\
                [0:v] setpts=PTS-STARTPTS, scale=224x192, drawtext=text='TESTO1'[r1p1];\
                [0:a] showvolume=b=1:h=10:w=200:o=v [r1p1a];\
                [1:v] setpts=PTS-STARTPTS, scale=224x192 [r1p2];\
                [1:a] showvolume=b=1:h=10:w=200:o=v [r1p2a];\
                [2:v] setpts=PTS-STARTPTS, scale=224x192 [r1p3];\
                [2:a] showvolume=b=1:h=10:w=200:o=v [r1p3a];\
                [3:v] setpts=PTS-STARTPTS, scale=224x192 [r1p4];\
                [3:a] showvolume=b=1:h=10:w=200:o=v [r1p4a];\
                [4:v] setpts=PTS-STARTPTS, scale=224x192 [r2p1];\
                [4:a] showvolume=b=1:h=10:w=200:o=v [r2p1a];\
                [5:v] setpts=PTS-STARTPTS, scale=224x192 [r2p2];\
                [5:a] showvolume=b=1:h=10:w=200:o=v [r2p2a];\
                [6:v] setpts=PTS-STARTPTS, scale=224x192 [r2p3];\
                [6:a] showvolume=b=1:h=10:w=200:o=v [r2p3a];\
                [7:v] setpts=PTS-STARTPTS, scale=224x192 [r2p4];\
                [7:a] showvolume=b=1:h=10:w=200:o=v [r2p4a];\
                [8:v] setpts=PTS-STARTPTS, scale=224x192 [r3p1];\
                [8:a] showvolume=b=1:h=10:w=200:o=v [r3p1a];\
                [9:v] setpts=PTS-STARTPTS, scale=224x192 [r3p2];\
                [9:a] showvolume=b=1:h=10:w=200:o=v [r3p2a];\
                [10:v] setpts=PTS-STARTPTS, scale=224x192 [r3p3];\
                [10:a] showvolume=b=1:h=10:w=200:o=v [r3p3a];\
                [11:v] setpts=PTS-STARTPTS, scale=224x192 [r3p4];\
                [11:a] showvolume=b=1:h=10:w=200:o=v [r3p4a];\
                [base][r1p1] overlay=shortest=0:x=50:y=10 [stop1]; [stop1][r1p1a] overlay=shortest=0:x=0:y=0 [tmp1];\
                [tmp1][r1p2] overlay=shortest=0:x=370:y=10 [stop2]; [stop2][r1p2a] overlay=shortest=0:x=320:y=0 [tmp2];\
                [tmp2][r1p3] overlay=shortest=0:x=690:y=10  [stop3]; [stop3][r1p3a] overlay=shortest=0:x=640:y=0 [tmp3];\
                [tmp3][r1p4] overlay=shortest=0:x=1010:y=10  [stop4]; [stop4][r1p4a] overlay=shortest=0:x=960:y=0 [tmp4];\
                [tmp4][r2p1] overlay=shortest=0:x=50:y=250 [stop5]; [stop5][r2p1a] overlay=shortest=0:x=0:y=240 [tmp5]; \
                [tmp5][r2p2] overlay=shortest=0:x=370:y=250 [stop6]; [stop6][r2p2a] overlay=shortest=0:x=320:y=240 [tmp6]; \
                [tmp6][r2p3] overlay=shortest=0:x=690:y=250 [stop7]; [stop7][r2p3a] overlay=shortest=0:x=640:y=240 [tmp7]; \
                [tmp7][r2p4] overlay=shortest=0:x=1010:y=250 [stop8]; [stop8][r2p4a] overlay=shortest=0:x=960:y=240 [tmp8]; \
                [tmp8][r3p1] overlay=shortest=0:x=50:y=490 [stop9]; [stop9][r3p1a] overlay=shortest=0:x=0:y=480 [tmp9]; \
                [tmp9][r3p2] overlay=shortest=0:x=370:y=490 [stop10]; [stop10][r3p2a] overlay=shortest=0:x=320:y=480 [tmp10]; \
                [tmp10][r3p3] overlay=shortest=0:x=690:y=490 [stop11]; [stop11][r3p3a] overlay=shortest=0:x=640:y=480 [tmp11]; \
                [tmp11][r3p4] overlay=shortest=0:x=1010:y=490 [stop12]; [stop12][r3p4a] overlay=shortest=0:x=960:y=480" \
-c:v mpeg2video -b:v 4M -minrate 4M -maxrate 4M -map 0 -map 1 -map 2 -map 3 -map 4 -map 5 -map 6 -map 7 -map 8 -map 9 -map 10 -map 11 -f mpegts udp://239.98.181.20:6000


The result is quite good but there is a major issue i cannot figure out how to fix.

Basically until all the streams are running fine the mosaic is perfect, but as soon as one of the input is missing all the mosaic stops and there is no way to let it start again.

Another issue (minor actually) is that ffmpeg, before to compose the mosaic, needs to analyze all the streams so it takes a lot to start.

Can anybody help me to find a solution please?

Thanks in advance.

Alex