我正在完成一个项目,该项目通过多次执行 ffmpeg 来检测并提取 TS 格式的离线录音中的特定亮点,从而输出 TS 文件。在最后一刻,我还被要求制作 M2TS 输出,我想我可以将输出的 TS 文件重新混合为 M2TS 格式。虽然 TS 输出在各方面都很好,但所有 M2TS 输出在该项目设计使用的播放器上都有音频故障。
该问题似乎与将 TS 重新混合为 M2TS 时出现的某条错误消息有关:-
"Stream 1, codec [mp2|mp3|aac|aac_latm], is muxed as a private data stream and may not be recognized upon reading."
确实,播放器看不到 M2TS 文件中明显包含音频的音轨。播放器似乎认为音频 ID 设置为零,因此他们不知道存在哪种类型的音频。我使用 VLC 进行了检查,它可以看到 TS 文件中的视频和音频,但只能看到 M2TS 文件中的视频。
我在英国,正在 Windows 7 上使用昨天从 Gyan Doshi 网站下载的最新 Windows 软件包“ffmpeg-2022-04-11-git-d6d46a2c50-essentials_build”进行测试。
以下是控制台输出:-
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%
测试输入文件绝不是完美的,在测试时记录下来以保证符合广播标准,但无论英国流 1 和 2 中经常使用的 mp2、mp3、aac 和 aac_latm 编解码器的输入材料是什么,都会出现同样的问题。
我做错了吗?
答案1
FFmpeg 支持 M2TS 中的以下音频编解码器:BluRay PCM、AC-3、E-AC-3、DTS 和 TrueHD。您必须转码为其中之一。