[FFmpeg-user] How to map specific audio channels in MPTS stream

Ilir Pruthi ipruthi at gmail.com
Sat Sep 13 09:27:28 CEST 2014


Hello,

I am receiving an MPTS stream where each Program has multiple audio tracks.
Only one of the audio tracks works, the others are 0-channels, thus dead
audio tracks. FFmpeg is giving me trouble because of those dead audio
tracks.

This is the partial MPTS stream output, showing just 2 of the programs:

  Program 11
    Metadata:
      service_name    : 20.1
      service_provider: Tandberg
    Stream #0:9[0x65]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(tv, bt470bg), 704x576 [SAR 12:11 DAR 4:3], 25 fps, 50 tbr, 90k tbn,
50 tbc
    Stream #0:28[0x101](mkd): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
stereo, s16p, 379 kb/s
    Stream #0:13[0x111](spa): Audio: mp3 ([6][0][0][0] / 0x0006), 0
channels, s16p
    Stream #0:10[0x115]: Audio: mp3 ([6][0][0][0] / 0x0006), 0 channels,
s16p
  Program 12
    Metadata:
      service_name    : 20.2
      service_provider: Tandberg
    Stream #0:6[0x1fcc]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(tv, bt470bg), 704x576 [SAR 12:11 DAR 4:3], 25 fps, 50 tbr, 90k tbn,
50 tbc
    Stream #0:7[0x100](mkd): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, s16p, 189 kb/s
    Stream #0:8[0x1fcd]: Audio: mp3 ([6][0][0][0] / 0x0006), 0 channels,
s16p


The FFmpeg commands I tried are:
$ ffmpeg -i "udp://@MY_IP_ADDRESS:XXXX?overrun_nonfatal=1&reuse=1" -map
0:p:11 -map 0:28  -vcodec libx264 -acodec copy -t 30 -f mpegts -y
program11.ts

But I get this error:
[mpegts @ 0x33a94e0] sample rate not set
Could not write header for output file #0 (incorrect codec parameters ?):
Invalid argument

I receive same error when I leave only the first -map parameter.

Can someone please show me how to use -map to pick only the working audio
tracks (in this case: mp2)?

Thank you in advance.

-Ilir


More information about the ffmpeg-user mailing list