[FFmpeg-user] Select a single program from mpegts

Robert Szelepcsényi robert at tankred.sk
Tue Nov 13 10:38:31 EET 2018


Hi,

I need an utility that can receive a complete mpeg transport stream on one
multicast address, select one particular program and stream it to another
multicast address. For example, this works perfectly for me:

ffmpeg -copy_unknown -i udp:/224.0.0.1:20001  -map 0:p:3001  -c copy  -f
mpegts udp://224.0.0.2:20001

Program #3001 is a standard SD channel with MPEG2 video and MP2 audio.

However, when I try to stream program #3003, which is a HD channel with H264
video, I get the following error:

[mpegts @ 0x55dda31d41a0] dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?):
Invalid argument

Metadata information for program #3001 is:

  Program 3001 
    Metadata:
      service_name    : Jednotka
      service_provider: Towercom
    Stream #0:14[0xc1e]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k
tbn, 50 tbc
    Stream #0:15[0xc27](slo): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, s16p, 192 kb/s
    Stream #0:16[0xc28](qaa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, s16p, 192 kb/s
    Stream #0:17[0xc29](slo): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
mono, s16p, 64 kb/s (visual impaired)
    Stream #0:0[0xc3a](slo): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:1[0xc3b]: Data: bin_data ([6][0][0][0] / 0x0006)

and metadata information for program #3003 is:

  Program 3003 
    Metadata:
      service_name    : Jednotka HD
      service_provider: Towercom
    Stream #0:0[0xc3a](slo): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:1[0xc3b]: Data: bin_data ([6][0][0][0] / 0x0006)
    Stream #0:2[0xce6]: Video: h264 (High) ([27][0][0][0] / 0x001B),
none(top first), 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:3[0xcef](slo): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, s16p, 192 kb/s
    Stream #0:4[0xcf0](qaa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, s16p, 192 kb/s
    Stream #0:5[0xcf2](slo): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
mono, s16p, 64 kb/s (visual impaired)
    Stream #0:6[0xd04]: Unknown: none ([5][0][0][0] / 0x0005)

It obviously lacks information about the picture size.

Increasing -probesize and -analyzeduration won’t help, but in fact, this is
not what I wish to do. I want ffmpeg just extract a given program and
generate a new mpegts without touching the contents. There is no problem
with completely unknown streams. I want the video and auto streams to be
handled in the same way. The end device can play  the program, so there is
no point in trying to add information about picture size, which for some
reason cannot be successfully extracted.

In other words I need something like the famed getstream, which was just
demultiplexer/remultiplexer and nothing else without any deeper analysis of
the streams' content.

Is there any switch to force all streams being handled as unknown?


Robert




More information about the ffmpeg-user mailing list