我正试图将具有以下输出的 .ts 文件转换为 mkv 格式:
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.27)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_4 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[mp3float @ 0x7fbd6282b200] Header missing
[mpegts @ 0x7fbd62809000] PES packet size mismatch
[mpegts @ 0x7fbd62809000] Packet corrupt (stream = 2, dts = 7125804577).
[mpegts @ 0x7fbd62809000] PES packet size mismatch
[mpegts @ 0x7fbd62809000] Packet corrupt (stream = 2, dts = 7125804577).
[mpegts @ 0x7fbd62809000] PES packet size mismatch
[mpegts @ 0x7fbd62809000] Packet corrupt (stream = 1, dts = 7125790091).
Input #0, mpegts, from '/Users/"User"/Downloads/input.ts':
Duration: 02:11:32.82, start: 71283.837456, bitrate: 17149 kb/s
Program 1
Stream #0:0[0x1004]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 2.08 tbr, 90k tbn, 100 tbc
Stream #0:1[0x1104](swe): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 256 kb/s
Stream #0:2[0x704](swe): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 640 kb/s
为了实现这个目的,我使用以下命令:
ffmpeg -i input.ts -c copy output.mkv
但是转换失败,并出现以下错误:
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x7fb8c1808200] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[matroska @ 0x7fb8c1808200] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument
[matroska @ 0x7fb8c1808200] Can't write packet with unknown timestamp
Error writing trailer of output.mkv: Invalid argument
frame= 27 fps=0.0 q=-1.0 Lsize= 74kB time=00:00:00.85 bitrate= 705.5kbits/s speed= 99x
video:1092kB audio:35kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
我应该怎样才能修复这个问题?我已经尝试在开头添加-fflags +genpts
,但它仍然失败。
编辑:我最终是使用了MKVToolNix解决了这个问题。