[FFmpeg-user] mpegts multiple streams metadata set problem.

Alexei ffmpeg at pcmind.pro
Fri Feb 5 11:45:53 EET 2021


Hey folks!
I'm trying to set metadata on some input streams before muxing them into one. But non of the options work.

inputflags="-fflags +igndts -reuse 1 -analyzeduration 3M -thread_queue_size 1M -probesize 3M -rtbufsize 356M"
udpflags="pkt_size=1316&fifo_size=2379746&overrun_nonfatal=1&buffer_size=655350000"
streamsrc='udp://239.5.6.1'

while [[ ! -e /tmp/stream.stop ]]; do
ffmpeg \
$inputflags -i "$streamsrc:5201?$udpflags" \
$inputflags -i "$streamsrc:5202?$udpflags" \
$inputflags -i "$streamsrc:5203?$udpflags" \
$inputflags -i "$streamsrc:5204?$udpflags" \
$inputflags -i "$streamsrc:5205?$udpflags" \
$inputflags -i "$streamsrc:5206?$udpflags" \
$inputflags -i "$streamsrc:5207?$udpflags" \
$inputflags -i "$streamsrc:5208?$udpflags" \
$inputflags -i "$streamsrc:5209?$udpflags" \
$inputflags -i "$streamsrc:5210?$udpflags" \
$inputflags -i "$streamsrc:5211?$udpflags" \
$inputflags -i "$streamsrc:5212?$udpflags" \
$inputflags -i "$streamsrc:5301?$udpflags" \
$inputflags -i "$streamsrc:5302?$udpflags" \
$inputflags -i "$streamsrc:5303?$udpflags" \
$inputflags -i "$streamsrc:5304?$udpflags" \
$inputflags -i "$streamsrc:5305?$udpflags" \
$inputflags -i "$streamsrc:5306?$udpflags" \
$inputflags -i "$streamsrc:5307?$udpflags" \
$inputflags -i "$streamsrc:5308?$udpflags" \
$inputflags -i "$streamsrc:5309?$udpflags" \
$inputflags -i "$streamsrc:5310?$udpflags" \
$inputflags -i "$streamsrc:5311?$udpflags" \
$inputflags -i "$streamsrc:5312?$udpflags" \
-map 0:0 -map 0:1 \
-map 1:0 -map 1:1 \
-map 2:0 -map 2:1 \
-map 3:0 -map 3:1 \
-map 4:0 -map 4:1 \
-map 5:0 -map 5:1 \
-map 6:0 -map 6:1 \
-map 7:0 -map 7:1 \
-map 8:0 -map 8:1 \
-map 9:0 -map 9:1 \
-map 10:0 -map 10:1 \
-map 11:0 -map 11:1 \
-map 12:0 -map 12:1 \
-map 13:0 -map 13:1 \
-map 14:0 -map 14:1 \
-map 15:0 -map 15:1 \
-map 16:0 -map 16:1 \
-map 17:0 -map 17:1 \
-map 18:0 -map 18:1 \
-map 19:0 -map 19:1 \
-map 20:0 -map 20:1 \
-map 21:0 -map 21:1 \
-map 22:0 -map 22:1 \
-map 23:0 -map 23:1 \
-program title='RO cl01':st=0:st=1 \
-program title='RO cl02':st=2:st=3 \
-program title='RO cl03':st=4:st=5 \
-program title='RO cl04':st=6:st=7 \
-program title='RO cl05':st=8:st=9 \
-program title='RO cl06':st=10:st=11 \
-program title='RO cl07':st=12:st=13 \
-program title='RO cl08':st=14:st=15 \
-program title='RO cl09':st=16:st=17 \
-program title='RO cl10':st=18:st=19 \
-program title='RO cl11':st=20:st=21 \
-program title='RO cl12':st=22:st=23 \
-program title='RU cl01':st=24:st=25 \
-program title='RU cl02':st=26:st=27 \
-program title='RU cl03':st=28:st=29 \
-program title='RU cl04':st=30:st=31 \
-program title='RU cl05':st=32:st=33 \
-program title='RU cl06':st=34:st=35 \
-program title='RU cl07':st=36:st=37 \
-program title='RU cl08':st=38:st=39 \
-program title='RU cl09':st=40:st=41 \
-program title='RU cl10':st=42:st=43 \
-program title='RU cl11':st=44:st=45 \
-program title='RU cl12':st=46:st=47 \
-metadata:s:v: service_provider="SomeName" \
-acodec copy \
-vcodec copy \
-threads 25 \
-pcr_period 20 \
-pat_period 0.3 \
-sdt_period 0.25 \
-packetsize 1316 \
-bufsize 65M \
-max_muxing_queue_size 2024 \
-muxrate 43000000 \
-use_wallclock_as_timestamps 1 \
-maxrate 43000000 \
-f mpegts \
-mpegts_service_type digital_tv \
-mpegts_original_network_id 0x1122 \
-mpegts_transport_stream_id 0x3344 \
-mpegts_service_id 0x5566 \
-mpegts_pmt_start_pid 0x1500 \
-mpegts_start_pid 0x150 \
-tune zerolatency \
-fflags +genpts \
-vsync 1 \
-reuse 1 \
-mpegts_flags system_b \
'udp://239.5.5.3:5800?pkt_size=1316&fifo_size=57113926&bitrate=43900000&overrun_nonfatal=1&buffer_size=65535000'
done


I did try -metadata:s:v:N, where N is stream number, -map-metadata 0 - nothing works. Output shows:

Output #0, mpegts, to 'udp://239.5.5.3:5800?pkt_size=1316&fifo_size=57113926&bitrate=43900000&overrun_nonfatal=1&buffer_size=65535000':
Metadata: 
encoder         : Lavf58.45.100
                                                                Program 1 Metadata:
title           : RO cl01
Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
Metadata:
service_provider: SomeName
Stream #0:1(eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 128 kb/s 

Somehow it sets metadata for audio stream. But at the same time

ffprobe -i udp://239.5.5.3:5800
...
  Program 24 
    Metadata:
      service_name    : RU cl12
      service_provider: FFmpeg
    Stream #0:46[0x17e]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 720x576 [SAR 64:45 DAR 16
    Stream #0:47[0x17f](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s

I have this output from ffprobe.


also, I've tried metadata option before -f mpegts, after and in other different places. Switched to rpt_mpegts. It sets metadata, but messes up services. I have IP Probe
DVB-T decoder that can't decode it, it sees one channel that has 24 streams and not 24 channels.



More information about the ffmpeg-user mailing list