Opened 3 years ago

Last modified 22 months ago

#4525 new enhancement

Add multi-program support in mpegts muxer

Reported by: saste Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mpegts
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Multi-programs MPEGTS input are correctly handled, and there is an API to set the Program structure.

For example consider this output:

$ ffprobe multi-programs.ts 
ffprobe version N-71578-g57865a9 Copyright (c) 2007-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --extra-cflags=-I/home/stefano/include --extra-ldflags=-L/home/stefano/lib --enable-libopenjpeg --enable-pic --enable-fontconfig --enable-libass --enable-version3 --prefix=/home/stefano --disable-shared --enable-static --enable-debug=3 --enable-pthreads --disable-optimizations --enable-libvorbis --enable-gpl --enable-nonfree --enable-libmp3lame --enable-libtheora --enable-gpl --enable-x11grab --enable-frei0r --enable-libfaac --enable-libcaca --enable-libflite --enable-libzmq --enable-libfreetype --enable-libopencv --enable-libgme --enable-libcdio --enable-libvo-aacenc --enable-libx264 --enable-ladspa --enable-libquvi --enable-opengl --enable-libvpx --enable-libxcb
  libavutil      54. 23.100 / 54. 23.100
  libavcodec     56. 35.101 / 56. 35.101
  libavformat    56. 30.100 / 56. 30.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 14.100 /  5. 14.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from 'multi-programs.ts':
  Duration: 00:05:00.03, start: 0.000278, bitrate: 1216 kb/s
  Program 1 
    Stream #0:0[0x65]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 10 fps, 10 tbr, 90k tbn, 20 tbc
  Program 2 
    Stream #0:1[0x6f]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
  Program 3 
    Stream #0:2[0x79]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 30 fps, 29.92 tbr, 90k tbn, 60 tbc

But programs are not handled in the mpegts muxer at the present time, so even when using the API the corresponding program structure is not stored in the MPEGTS output.

With ffmpeg we get this behavior:

$ ffmpeg -i multi-programs.ts -codec copy -map 0 multi-programs.out.ts
ffmpeg version N-71578-g57865a9 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --extra-cflags=-I/home/stefano/include --extra-ldflags=-L/home/stefano/lib --enable-libopenjpeg --enable-pic --enable-fontconfig --enable-libass --enable-version3 --prefix=/home/stefano --disable-shared --enable-static --enable-debug=3 --enable-pthreads --disable-optimizations --enable-libvorbis --enable-gpl --enable-nonfree --enable-libmp3lame --enable-libtheora --enable-gpl --enable-x11grab --enable-frei0r --enable-libfaac --enable-libcaca --enable-libflite --enable-libzmq --enable-libfreetype --enable-libopencv --enable-libgme --enable-libcdio --enable-libvo-aacenc --enable-libx264 --enable-ladspa --enable-libquvi --enable-opengl --enable-libvpx --enable-libxcb
  libavutil      54. 23.100 / 54. 23.100
  libavcodec     56. 35.101 / 56. 35.101
  libavformat    56. 30.100 / 56. 30.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 14.100 /  5. 14.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from 'multi-programs.ts':
  Duration: 00:05:00.03, start: 0.000278, bitrate: 1216 kb/s
  Program 1 
    Stream #0:0[0x65]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 10 fps, 10 tbr, 90k tbn, 20 tbc
  Program 2 
    Stream #0:1[0x6f]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
  Program 3 
    Stream #0:2[0x79]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 30 fps, 29.92 tbr, 90k tbn, 60 tbc
Output #0, mpegts, to 'multi-programs.out.ts':
  Metadata:
    encoder         : Lavf56.30.100
    Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 4:3 DAR 16:9], q=2-31, 10 fps, 10 tbr, 90k tbn, 10 tbc
    Stream #0:1: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 4:3 DAR 16:9], q=2-31, 30 fps, 30 tbr, 90k tbn, 30 tbc
    Stream #0:2: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 30 fps, 29.92 tbr, 90k tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame= 2988 fps=0.0 q=-1.0 Lq=-1.0 q=-1.0 size=   47966kB time=00:05:00.02 bitrate=1309.7kbits/s    
video:42075kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 14.001903%
$ ffprobe multi-programs.out.ts 
ffprobe version N-71578-g57865a9 Copyright (c) 2007-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --extra-cflags=-I/home/stefano/include --extra-ldflags=-L/home/stefano/lib --enable-libopenjpeg --enable-pic --enable-fontconfig --enable-libass --enable-version3 --prefix=/home/stefano --disable-shared --enable-static --enable-debug=3 --enable-pthreads --disable-optimizations --enable-libvorbis --enable-gpl --enable-nonfree --enable-libmp3lame --enable-libtheora --enable-gpl --enable-x11grab --enable-frei0r --enable-libfaac --enable-libcaca --enable-libflite --enable-libzmq --enable-libfreetype --enable-libopencv --enable-libgme --enable-libcdio --enable-libvo-aacenc --enable-libx264 --enable-ladspa --enable-libquvi --enable-opengl --enable-libvpx --enable-libxcb
  libavutil      54. 23.100 / 54. 23.100
  libavcodec     56. 35.101 / 56. 35.101
  libavformat    56. 30.100 / 56. 30.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 14.100 /  5. 14.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from 'multi-programs.out.ts':
  Duration: 00:05:00.03, start: 1.400000, bitrate: 1309 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 10 fps, 10 tbr, 90k tbn, 20 tbc
    Stream #0:1[0x101]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:2[0x102]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 30 fps, 29.92 tbr, 90k tbn, 60 tbc

that is only a single program containing all the streams is written to the output.

Change History (1)

comment:1 Changed 22 months ago by cehoyos

  • Keywords program removed
  • Priority changed from normal to wish
Note: See TracTickets for help on using tickets.