<p>This should work.</p>

<pre><code>ffmpeg -i KeanuRambo.ts -i KeanuLincoln.ts -i KeanuBush.ts \
-map 0:0 -map 0:1 -map 1:0 -map 1:1 -map 2:0 -map 2:1 \
-program program_num=1:title=Ram:st=0:st=1 -program program_num=2:title=Linc:st=2:st=3 \ 
-program program_num=3:title=Bush:st=4:st=5 \
-f mpegts out5.ts 
</code></pre>

CC BY-SA 4.0
2018-05-08T07:20:55.883Z
2018-05-08T07:20:55.883Z
Gyan
<p>I want to build a transport stream with multiple programs. To simplify the original post, I'm using three files that are the same video, but with different watermarks to track them. (Went this way b/c Gyans request for full log makes this shorter)</p>

<pre><code>ffmpeg -i KeanuRambo.ts -i KeanuLincoln.ts -i KeanuBush.ts \
-map 0:0 -map 0:1 -map 1:0 -map 1:1 -map 2:0 -map 2:1 \
-program program_num=1:title=Ram:s0:s1 -program program_num=2:title=Linc:s2:s3 \ 
-program program_num=3:title=Bush:s4:s5 \
-report -f mpegts out5.ts 
</code></pre>

<p>The output file is zero bytes. Here is what the -report produced:</p>

<pre><code>fmpeg started on 2018-05-07 at 22:33:23
Report written to "ffmpeg-20180507-223323.log"
Command line:
ffmpeg -i KeanuRambo.ts -i KeanuLincoln.ts -i KeanuBush.ts -map 0:0 -map 0:1 -map 1:0 -map 1:1 -map 2:0 -map 2:1 -program "program_num=1:title=Ram:s0:s1" -program "program_num=2:title=Linc:s2:s3" -program "program_num=3:title=Bush:s4:s5" -report -f mpegts out5.ts
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'KeanuRambo.ts'.
Reading option '-i' ... matched as input url with argument 'KeanuLincoln.ts'.
Reading option '-i' ... matched as input url with argument 'KeanuBush.ts'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:1'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1:0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1:1'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '2:0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '2:1'.
Reading option '-program' ... matched as option 'program' (add program with specified streams) with argument 'program_num=1:title=Ram:s0:s1'.
Reading option '-program' ... matched as option 'program' (add program with specified streams) with argument 'program_num=2:title=Linc:s2:s3'.
Reading option '-program' ... matched as option 'program' (add program with specified streams) with argument 'program_num=3:title=Bush:s4:s5'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mpegts'.
Reading option 'out5.ts' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url KeanuRambo.ts.
Successfully parsed a group of options.
Opening an input file: KeanuRambo.ts.
[NULL @ 0x7fc093801000] Opening 'KeanuRambo.ts' for reading
[file @ 0x7fc091d00de0] Setting default whitelist 'file,crypto'
[mpegts @ 0x7fc093801000] Format mpegts probed with size=2048 and score=50
[mpegts @ 0x7fc093801000] stream=0 stream_type=2 pid=100 prog_reg_desc=
[mpegts @ 0x7fc093801000] stream=1 stream_type=3 pid=101 prog_reg_desc=
[mpegts @ 0x7fc093801000] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
[mpegts @ 0x7fc093801000] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
[mpegts @ 0x7fc093801000] After avformat_find_stream_info() pos: 0 bytes read:2576528 seeks:2 frames:346
Input #0, mpegts, from 'KeanuRambo.ts':
  Duration: 00:03:26.31, start: 1.422422, bitrate: 2569 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100], 152, 1/90000: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x101](und), 194, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 384 kb/s
Successfully opened the file.
Parsing a group of options: input url KeanuLincoln.ts.
Successfully parsed a group of options.
Opening an input file: KeanuLincoln.ts.
[NULL @ 0x7fc09280be00] Opening 'KeanuLincoln.ts' for reading
[file @ 0x7fc091f00000] Setting default whitelist 'file,crypto'
[mpegts @ 0x7fc09280be00] Format mpegts probed with size=2048 and score=50
[mpegts @ 0x7fc09280be00] stream=0 stream_type=2 pid=100 prog_reg_desc=
[mpegts @ 0x7fc09280be00] stream=1 stream_type=3 pid=101 prog_reg_desc=
[mpegts @ 0x7fc09280be00] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
[mpegts @ 0x7fc09280be00] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
[mpegts @ 0x7fc09280be00] After avformat_find_stream_info() pos: 0 bytes read:2543760 seeks:2 frames:346
Input #1, mpegts, from 'KeanuLincoln.ts':
  Duration: 00:03:26.31, start: 1.422422, bitrate: 2560 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #1:0[0x100], 152, 1/90000: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #1:1[0x101](und), 194, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 384 kb/s
Successfully opened the file.
Parsing a group of options: input url KeanuBush.ts.
Successfully parsed a group of options.
Opening an input file: KeanuBush.ts.
[NULL @ 0x7fc092833a00] Opening 'KeanuBush.ts' for reading
[file @ 0x7fc091f00b00] Setting default whitelist 'file,crypto'
[mpegts @ 0x7fc092833a00] Format mpegts probed with size=2048 and score=50
[mpegts @ 0x7fc092833a00] stream=0 stream_type=2 pid=100 prog_reg_desc=
[mpegts @ 0x7fc092833a00] stream=1 stream_type=3 pid=101 prog_reg_desc=
[mpegts @ 0x7fc092833a00] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
[mpegts @ 0x7fc092833a00] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
[mpegts @ 0x7fc092833a00] After avformat_find_stream_info() pos: 0 bytes read:1626256 seeks:2 frames:346
Input #2, mpegts, from 'KeanuBush.ts':
  Duration: 00:03:26.31, start: 1.422422, bitrate: 1549 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #2:0[0x100], 152, 1/90000: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #2:1[0x101](und), 194, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 384 kb/s
Successfully opened the file.
Parsing a group of options: output url out5.ts.
Applying option map (set input stream mapping) with argument 0:0.
Applying option map (set input stream mapping) with argument 0:1.
Applying option map (set input stream mapping) with argument 1:0.
Applying option map (set input stream mapping) with argument 1:1.
Applying option map (set input stream mapping) with argument 2:0.
Applying option map (set input stream mapping) with argument 2:1.
Applying option program (add program with specified streams) with argument program_num=1:title=Ram:s0:s1.
Applying option program (add program with specified streams) with argument program_num=2:title=Linc:s2:s3.
Applying option program (add program with specified streams) with argument program_num=3:title=Bush:s4:s5.
Applying option f (force format) with argument mpegts.
Successfully parsed a group of options.
Opening an output file: out5.ts.
[file @ 0x7fc091c0f8a0] Setting default whitelist 'file,crypto'
[AVIOContext @ 0x7fc091c0fd40] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x7fc091d00f20] Statistics: 2576528 bytes read, 2 seeks
[AVIOContext @ 0x7fc091f00f20] Statistics: 2543760 bytes read, 2 seeks
[AVIOContext @ 0x7fc091f03d60] Statistics: 1626256 bytes read, 2 seeks
</code></pre>

CC BY-SA 4.0
2018-05-05T05:52:02.597Z
Share full log.
Gyan
CC BY-SA 4.0
2018-05-08T02:41:14.913Z
Content updated (log was 1.7MB) to just use same video and now the log is much cleaner.
Kenny C
<ffmpeg>
FFMPEG - build transport stream with multiple programs
Kenny C
# FFMPEG - build transport stream with multiple programs

(Asked by: username_0 on 2018-05-04)

I want to build a transport stream with multiple programs. To simplify the original post, I'm using three files that are the same video, but with different watermarks to track them. (Went this way b/c username_1s request for full log makes this shorter)
ffmpeg -i KeanuRambo.ts -i KeanuLincoln.ts -i KeanuBush.ts \
-map 0:0 -map 0:1 -map 1:0 -map 1:1 -map 2:0 -map 2:1 \
-program program_num=1:title=Ram:s0:s1 -program program_num=2:title=Linc:s2:s3 \ 
-program program_num=3:title=Bush:s4:s5 \
-report -f mpegts out5.ts 

The output file is zero bytes. Here is what the -report produced:
fmpeg started on 2018-05-07 at 22:33:23
Report written to "ffmpeg-20180507-223323.log"
Command line:
ffmpeg -i KeanuRambo.ts -i KeanuLincoln.ts -i KeanuBush.ts -map 0:0 -map 0:1 -map 1:0 -map 1:1 -map 2:0 -map 2:1 -program "program_num=1:title=Ram:s0:s1" -program "program_num=2:title=Linc:s2:s3" -program "program_num=3:title=Bush:s4:s5" -report -f mpegts out5.ts
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'KeanuRambo.ts'.
Reading option '-i' ... matched as input url with argument 'KeanuLincoln.ts'.
Reading option '-i' ... matched as input url with argument 'KeanuBush.ts'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:1'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1:0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1:1'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '2:0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '2:1'.
Reading option '-program' ... matched as option 'program' (add program with specified streams) with argument 'program_num=1:title=Ram:s0:s1'.
Reading option '-program' ... matched as option 'program' (add program with specified streams) with argument 'program_num=2:title=Linc:s2:s3'.
Reading option '-program' ... matched as option 'program' (add program with specified streams) with argument 'program_num=3:title=Bush:s4:s5'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mpegts'.
Reading option 'out5.ts' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url KeanuRambo.ts.
Successfully parsed a group of options.
Opening an input file: KeanuRambo.ts.
[NULL @ 0x7fc093801000] Opening 'KeanuRambo.ts' for reading
[file @ 0x7fc091d00de0] Setting default whitelist 'file,crypto'
[mpegts @ 0x7fc093801000] Format mpegts probed with size=2048 and score=50
[mpegts @ 0x7fc093801000] stream=0 stream_type=2 pid=100 prog_reg_desc=
[mpegts @ 0x7fc093801000] stream=1 stream_type=3 pid=101 prog_reg_desc=
[mpegts @ 0x7fc093801000] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
[mpegts @ 0x7fc093801000] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
[mpegts @ 0x7fc093801000] After avformat_find_stream_info() pos: 0 bytes read:2576528 seeks:2 frames:346
Input #0, mpegts, from 'KeanuRambo.ts':
  Duration: 00:03:26.31, start: 1.422422, bitrate: 2569 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100], 152, 1/90000: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x101](und), 194, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 384 kb/s
Successfully opened the file.
Parsing a group of options: input url KeanuLincoln.ts.
Successfully parsed a group of options.
Opening an input file: KeanuLincoln.ts.
[NULL @ 0x7fc09280be00] Opening 'KeanuLincoln.ts' for reading
[file @ 0x7fc091f00000] Setting default whitelist 'file,crypto'
[mpegts @ 0x7fc09280be00] Format mpegts probed with size=2048 and score=50
[mpegts @ 0x7fc09280be00] stream=0 stream_type=2 pid=100 prog_reg_desc=
[mpegts @ 0x7fc09280be00] stream=1 stream_type=3 pid=101 prog_reg_desc=
[mpegts @ 0x7fc09280be00] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
[mpegts @ 0x7fc09280be00] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
[mpegts @ 0x7fc09280be00] After avformat_find_stream_info() pos: 0 bytes read:2543760 seeks:2 frames:346
Input #1, mpegts, from 'KeanuLincoln.ts':
  Duration: 00:03:26.31, start: 1.422422, bitrate: 2560 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #1:0[0x100], 152, 1/90000: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #1:1[0x101](und), 194, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 384 kb/s
Successfully opened the file.
Parsing a group of options: input url KeanuBush.ts.
Successfully parsed a group of options.
Opening an input file: KeanuBush.ts.
[NULL @ 0x7fc092833a00] Opening 'KeanuBush.ts' for reading
[file @ 0x7fc091f00b00] Setting default whitelist 'file,crypto'
[mpegts @ 0x7fc092833a00] Format mpegts probed with size=2048 and score=50
[mpegts @ 0x7fc092833a00] stream=0 stream_type=2 pid=100 prog_reg_desc=
[mpegts @ 0x7fc092833a00] stream=1 stream_type=3 pid=101 prog_reg_desc=
[mpegts @ 0x7fc092833a00] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
[mpegts @ 0x7fc092833a00] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
[mpegts @ 0x7fc092833a00] After avformat_find_stream_info() pos: 0 bytes read:1626256 seeks:2 frames:346
Input #2, mpegts, from 'KeanuBush.ts':
  Duration: 00:03:26.31, start: 1.422422, bitrate: 1549 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #2:0[0x100], 152, 1/90000: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #2:1[0x101](und), 194, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 384 kb/s
Successfully opened the file.
Parsing a group of options: output url out5.ts.
Applying option map (set input stream mapping) with argument 0:0.
Applying option map (set input stream mapping) with argument 0:1.
Applying option map (set input stream mapping) with argument 1:0.
Applying option map (set input stream mapping) with argument 1:1.
Applying option map (set input stream mapping) with argument 2:0.
Applying option map (set input stream mapping) with argument 2:1.
Applying option program (add program with specified streams) with argument program_num=1:title=Ram:s0:s1.
Applying option program (add program with specified streams) with argument program_num=2:title=Linc:s2:s3.
Applying option program (add program with specified streams) with argument program_num=3:title=Bush:s4:s5.
Applying option f (force format) with argument mpegts.
Successfully parsed a group of options.
Opening an output file: out5.ts.
[file @ 0x7fc091c0f8a0] Setting default whitelist 'file,crypto'
[AVIOContext @ 0x7fc091c0fd40] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x7fc091d00f20] Statistics: 2576528 bytes read, 2 seeks
[AVIOContext @ 0x7fc091f00f20] Statistics: 2543760 bytes read, 2 seeks
[AVIOContext @ 0x7fc091f03d60] Statistics: 1626256 bytes read, 2 seeks

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Share full log.  
> **username_0**: Content updated (log was 1.7MB) to just use same video and now the log is much cleaner.  

---

## 1 answers

### Answer by username_1 on 2018-05-08. Score: 3

This should work.
ffmpeg -i KeanuRambo.ts -i KeanuLincoln.ts -i KeanuBush.ts \
-map 0:0 -map 0:1 -map 1:0 -map 1:1 -map 2:0 -map 2:1 \
-program program_num=1:title=Ram:st=0:st=1 -program program_num=2:title=Linc:st=2:st=3 \ 
-program program_num=3:title=Bush:st=4:st=5 \
-f mpegts out5.ts


---

