1

I am finishing a project which outputs TS files by exec'ing ffmpeg multiple times to detect and extract specific highlights from offair recordings in TS format. At the last minute I have been asked to produce M2TS output as well, and thought I could remux my output TS files into M2TS format. While the TS output is fine in all respects, all of the M2TS outputs have faulty audio on the players that this project is designed to work with.

The problem seems to be connected to the appearance of a certain error message while remuxing TS to M2TS:-

"Stream 1, codec [mp2|mp3|aac|aac_latm], is muxed as a private data stream and may not be recognized upon reading."

Indeed, the players don't see an audio track where audio is obviously included in the M2TS file. The players seem to think that the Audio ID is set to zero, so they don't know what type of audio is present. I have checked using VLC which can see both video and audio in the TS file, but can only see video in the M2TS file.

I am in the United Kingdom, and testing on Windows 7 with the latest Windows package 'ffmpeg-2022-04-11-git-d6d46a2c50-essentials_build' downloaded yesterday from Gyan Doshi's website.

Here is the console output:-

ffmpeg -i testinput.ts -c copy -mpegts_flags system_b -mpegts_service_type 1 -y testoutput.m2ts
ffmpeg version 2022-04-11-git-d6d46a2c50-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-
iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable
-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-li
bopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enabl
e-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d
11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheo
ra --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-li
brubberband
  libavutil      57. 24.101 / 57. 24.101
  libavcodec     59. 26.100 / 59. 26.100
  libavformat    59. 21.100 / 59. 21.100
  libavdevice    59.  6.100 / 59.  6.100
  libavfilter     8. 30.100 /  8. 30.100
  libswscale      6.  6.100 /  6.  6.100
  libswresample   4.  6.100 /  4.  6.100
  libpostproc    56.  5.100 / 56.  5.100
[mpeg2video @ 00000000004c7400] Invalid frame dimensions 0x0.
    Last message repeated 10 times
[mpegts @ 00000000004c43c0] start time for stream 3 is not set in estimate_timings_from_pts
[mpegts @ 00000000004c43c0] PES packet size mismatch
[mpegts @ 00000000004c43c0] Packet corrupt (stream = 1, dts = 6101525464).
[mpegts @ 00000000004c43c0] PES packet size mismatch
[mpegts @ 00000000004c43c0] Packet corrupt (stream = 2, dts = 6101525464).
[mpegts @ 00000000004c43c0] Could not find codec parameters for stream 4 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from 'testinput.ts':
  Duration: 02:38:29.16, start: 58286.263378, bitrate: 2000 kb/s
  Program 8385
  Stream #0:0[0x5dd]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 720x576 [SAR 64:45 DAR 16:9], 25 fps,
 25 tbr, 90k tbn
    Side data:
      cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1[0x5de](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
  Stream #0:2[0x5df](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, mono, s16p, 64 kb/s (visual impaired) (descriptions)
  Stream #0:3[0x5fb](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
  Stream #0:4[0xbbd]: Unknown: none ([5][0][0][0] / 0x0005)
Output #0, mpegts, to 'testoutput.m2ts':
  Metadata:
    encoder         : Lavf59.21.100
  Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 25 fps
, 25 tbr, 90k tbn
    Side data:
      cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 000000000052b300] Stream 1, codec mp2, is muxed as a private data stream and may not be recognized upon reading.
[mpegts @ 00000000004c43c0] PES packet size mismatch:35:46.72 bitrate=1994.2kbits/s speed= 175x
[mpegts @ 00000000004c43c0] Packet corrupt (stream = 1, dts = 6101525464).
testinput.ts: corrupt input packet in stream 1
    Last message repeated 1 times
frame=237698 fps=4409 q=-1.0 Lsize= 2314878kB time=02:38:29.00 bitrate=1994.3kbits/s speed= 176x
video:1931784kB audio:222856kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.436902%

The test input file is by no means perfect, recorded offair to guarantee some compliance with broadcast standards while testing, but the same problem occurs regardless of input material for the mp2, mp3, aac and aac_latm codecs that are often used in streams 1 and 2 in the UK.

Am I doing it wrong?

RGR
  • 11

1 Answers1

0

FFmpeg supports the following audio codecs in M2TS: BluRay PCM, AC-3, E-AC-3, DTS and TrueHD. You'll have to transcode to one of these.

Gyan
  • 38,955