[FFmpeg-user] HLS ABR packaging from multiple MPEGTS sources

Denis Lemire denis at lemire.name
Tue Dec 3 17:00:39 EET 2019


Hello,

I'm trying to use FFmpeg to package three MPEGTS streams that are the same
source at different resolutions, bitrates and overall quality profile into
an ABR HLS feed.

I can make it work using an ffmpeg process per MPEGTS input / HLS output
and then manually creating a playlist but I'm trying to figure out if
there's an elegant way to do it with a single process or if there are other
advantages in doing so.

I was trying something like:

/usr/local/bin/ffmpeg \
-i 'udp://239.x.x.127:1241' -i 'udp://239.x.x.127:1244 -i
'udp://239.x.x.127:1247' \
-map '#0:0' -map '#0:1' -codec copy -f hls low.m3u8 \
-map '#1:0' -map '#1:1' -codec copy -f hls med.m3u8 \
-map '#2:0' -map '#2:1' -codec copy -f hls high.m3u8


When attempting to run it this way I get something like:

Input #0, mpegts, from 'udp://239.x.x.127:1241':
  Duration: N/A, start: 63021.092978, bitrate: N/A
  Program 1
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 512x288 [SAR 1:1 DAR 16:9], Closed Captions, 59.94
fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 84 kb/s
    Stream #0:2[0x102](afr): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 62 kb/s

Input #1, mpegts, from 'udp://239.x.x.127:1244':
  Duration: N/A, start: 63026.170311, bitrate: N/A
 Program 1
    Stream #1:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 896x504 [SAR 1:1 DAR 16:9], Closed Captions, 59.94
fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #1:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 125 kb/s
    Stream #1:2[0x102](afr): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 133 kb/s

Input #2, mpegts, from 'udp://239.x.x.127:1247':
  Duration: N/A, start: 63031.247644, bitrate: N/A
  Program 1
    Stream #2:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 59.94
fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #2:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 127 kb/s
    Stream #2:2[0x102](afr): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 126 kb/s

[mpegts @ 0x55bea4125380] Invalid stream specifier: #0:0.
    Last message repeated 5 times
Stream map '#0:0' matches no streams.
To ignore this, add a trailing '?' to the map.

Am I missing something obvious in terms of mapping multiple MPEGTS streams
into multiple HLS outputs... Is the approach I'm attempting valid?


More information about the ffmpeg-user mailing list