[FFmpeg-user] Multiplexing
Anton Kapela
tkapela at gmail.com
Wed Jun 2 23:37:34 EEST 2021
On Mon, May 24, 2021 at 7:04 AM Mettavihari D <tv.lists at gmail.com> wrote:
> I would be very happy to have a link where I could learn about multiplexing
> and find out if that could also be done by ffmpeg or whether
> multiplexing hardware is essential.
I would recommend doing your own searches for this, but here are a few
that come to mind:
https://stackoverflow.com/questions/31413992/multiplexing-multiple-single-video-mpeg-ts-into-mpts-using-ffmpeg
https://video.stackexchange.com/questions/23963/ffmpeg-build-transport-stream-with-multiple-programs
...and here are a few examples doing various things which should be
fairly obvious, given the input file names and program titles, etc:
while true ; do ffmpeg -fflags +discardcorrupt \
-stream_loop -1 -re -i
/mnt/space3/enc-tmp/test-pat/tp-1080-23-98-lv4-500k-plus-y420-atsc-friendly.mkv
\
-stream_loop -1 -re -i
/mnt/space3/enc-tmp/test-pat/tp-1080-29-97-lv4-500k-plus-y420-atsc-friendly.mkv
\
-stream_loop -1 -re -i
/mnt/space3/enc-tmp/test-pat/tp-hevc-4k-23-98-y420l10-1m-atsc-friendly.mkv
\
-stream_loop -1 -re -i
/mnt/space3/enc-tmp/test-pat/tp-hevc-4k-29-97-y420l10-1m-atsc-friendly.mkv
\
-f lavfi -i "sine=sample_rate=48000:frequency=1000" \
-map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0 \
-program title="14.3 - AVC 24p test loop":st=0:st=4 \
-program title="14.4 - AVC 30p test loop":st=1:st=4 \
-program title="14.5 - HEVC 24p test loop":st=2:st=4 \
-program title="14.6 - HEVC 30p test loop":st=3:st=4 \
-c:a ac3 -ac 2 -ab 128k -c:v copy \
-map_metadata -1 -map_chapters -1 \
-f mpegts -muxdelay 1 -output_ts_offset 2 -flush_packets 1 -pcr_period
40 -pat_period 0.10 -sdt_period 0.25 -muxrate 10000000 \
udp://10.0.0.3:1400?pkt_size=1316\&bitrate=10000000 \
; sleep 1 ; done
...and finally a slightly more interesting mux, for a ATSC
1.0-friendly payload bitrate & shaped MPTS - of course, lacking in
PSIP tables as those patches aren't yet included in ffmpeg
(see: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20190521144012.23112-1-phil.burr@gmail.com/):
while true ; do ffmpeg -fflags +discardcorrupt \
-stream_loop -1 -i tcp://10.0.0.5:1401?timeout=5000000 \
-stream_loop -1 -i tcp://10.0.0.6:1402?timeout=5000000 \
-stream_loop -1 -async 1000 -re -i
/mnt/space3/enc-tmp/test-pat/tp-1080-23-98-lv4-500k-plus-y420-atsc-friendly.mkv
\
-stream_loop -1 -async 1000 -re -i
/mnt/space3/enc-tmp/test-pat/tp-1080-29-97-lv4-500k-plus-y420-atsc-friendly.mkv
\
-stream_loop -1 -async 1000 -re -i
/mnt/space3/enc-tmp/test-pat/tp-hevc-4k-23-98-y420l10-1m-atsc-friendly.mkv
\
-stream_loop -1 -async 1000 -re -i
/mnt/space3/enc-tmp/test-pat/tp-hevc-4k-29-97-y420l10-1m-atsc-friendly.mkv
\
-stream_loop -1 -async 1000 -re -i
/mnt/space3/enc-tmp/blade-runner-2049-uhd-4k-high10-4m-6mx-700me-atsc-friendly.mkv
\
-stream_loop -1 -async 1000 -re -i
/mnt/space3/enc-tmp/tenet-uhd-4k-high10-4m-6mx-700me-atsc-friendly.mkv
\
-stream_loop -1 -async 1000 -i http://stream.wortfm.org:8000/ultra.mp3 \
-stream_loop -1 -async 1000 -i
https://ice23.securenetsystems.net/WSUMFM?playSessionID=AB5A1175-D3FE-CD26-3282E9616D5B0726
\
-f lavfi -i "sine=sample_rate=48000:frequency=1000" \
-map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -map 5:0 -map 6:0 -map
6:1 -map 7:0 -map 7:1 -map 8:0 -map 9:0 -map 10:0 \
-program title="14.1 - webbycast 1":st=0:st=10 \
-program title="14.2 - webbycast 2":st=1:st=11 \
-program title="14.3 - AVC 24p test loop":st=2:st=12 \
-program title="14.4 - AVC 30p test loop":st=3:st=12 \
-program title="14.5 - HEVC 24p test loop":st=4:st=12 \
-program title="14.6 - HEVC 30p test loop":st=5:st=12 \
-program title="14.7 - HEVC 24p movie channel 1":st=6:st=7 \
-program title="14.8 - HEVC 24p movie channel 2":st=8:st=9 \
-af aresample=48000:async=1000:dither_method=improved_e_weighted \
-c:a ac3 -ac 2 -ab 160k -c:v copy \
-map_metadata -1 -map_chapters -1 \
-f mpegts -muxdelay 1 -output_ts_offset 2 -flush_packets 1 -pcr_period
40 -pat_period 0.10 -sdt_period 0.25 -muxrate 19392658 \
udp://10.0.0.3:1400?pkt_size=1316\&bitrate=19392658 \
; sleep 1 ; done
-Tk
More information about the ffmpeg-user
mailing list