![ffmpeg 音频转换和多路复用错误/警告消息](https://linux22.com/image/1576306/ffmpeg%20%E9%9F%B3%E9%A2%91%E8%BD%AC%E6%8D%A2%E5%92%8C%E5%A4%9A%E8%B7%AF%E5%A4%8D%E7%94%A8%E9%94%99%E8%AF%AF%2F%E8%AD%A6%E5%91%8A%E6%B6%88%E6%81%AF.png)
我有大量蓝光收藏,想将其放入我的 iTunes 资料库以便在 AppleTV 上播放。
我需要将不同的音频流转换为适当的格式。
但有几个错误/警告消息我需要处理。
以下是一些示例代码片段:
mkvmerge -i german_dd_to_alac__english_truehd_to_alac.mkv
mkvextract tracks german_dd_to_alac__english_truehd_to_alac.mkv 0:video.h264 1:audio1.ac3 2:audio2.truehd 3:audio2_core.ac3 4:sub1.srt
ffmpeg -i german_dd_to_alac__english_truehd_to_alac.mkv -f ffmetadata chapters
ffmpeg -i audio1.ac3 -acodec alac audio1.m4a
[ac3 @ 0000000000502b40] Estimating duration from bitrate, this may be inaccurate
[alac @ 000000000050cc40] encoding as 24 bits-per-sample
ffmpeg -i audio2.truehd -acodec alac -af "aformat=channel_layouts=7.1(wide)" audio2.m4a
[out_0_0 @ 000000000046bc40] 100 buffers queued in out_0_0, something may be wrong.
ffmpeg^
-probesize 2147483648 -i video.h264 -i audio1_alac.m4a -i audio2_alac.m4a -i sub1.srt -i chapters^
-map 0:0 -map 1:0 -map 2:0 -map 3:0^
-metadata:s:a:0 language=ger -metadata:s:a:0 handler="Dolby Digital"^
-metadata:s:a:1 language=eng -metadata:s:a:1 handler="Dolby TrueHD"^
-metadata:s:s:0 language=ger -metadata:s:s:0 handler="Deutsch"^
-movflags disable_chpl^
-c:s mov_text -c:v copy -c:a copy^
german_dd_to_alac__english_truehd_to_alac.m4v 2>> ffmpeg.log
[ipod @ 000000000338c040] track 1: codec frame size is not set
[ipod @ 000000000338c040] track 2: codec frame size is not set
[ipod @ 000000000338c040] 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
[ipod @ 000000000338c040] pts has no value
_
mkvmerge -i german_dts_to_alac__english_dtshdma_to_alac.mkv
mkvextract tracks german_dts_to_alac__english_dtshdma_to_alac.mkv 0:video.h264 1:audio1.dts 2:audio2.dtshdma 3:sub1.srt
ffmpeg -i german_dts_to_alac__english_dtshdma_to_alac.mkv -f ffmetadata chapters
ffmpeg -i audio1.dts -acodec alac audio1.m4a
[dts @ 0000000000332a80] Estimating duration from bitrate, this may be inaccurate
[alac @ 0000000000339d80] encoding as 24 bits-per-sample
ffmpeg -i audio2.dtshdma -acodec alac audio2.m4a
ffmpeg^
-probesize 2147483648 -i video.h264 -i audio1_alac.m4a -i audio2_alac.m4a -i sub1.srt -i chapters^
-map 0:0 -map 1:0 -map 2:0 -map 3:0^
-metadata:s:a:0 language=ger -metadata:s:a:0 handler="DTS"^
-metadata:s:a:1 language=eng -metadata:s:a:1 handler="DTS-HD Master Audio"^
-metadata:s:s:0 language=ger -metadata:s:s:0 handler="Deutsch"^
-movflags disable_chpl^
-c:s mov_text -c:v copy -c:a copy^
german_dts_to_alac__english_dtshdma_to_alac.m4v 2>> ffmpeg.log
[ipod @ 0000000002afe740] track 1: codec frame size is not set
[ipod @ 0000000002afe740] track 2: codec frame size is not set
[ipod @ 0000000002afe740] 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
[ipod @ 0000000002afe740] pts has no value
_
mkvmerge -i german_dtshr_to_alac__english_dtshdma_to_alac.mkv
mkvextract tracks german_dtshr_to_alac__english_dtshdma_to_alac.mkv 0:video.h264 1:audio1.dtshr 2:audio2.dtshdma
ffmpeg -i german_dtshr_to_alac__english_dtshdma_to_alac.mkv -f ffmetadata chapters
ffmpeg -i audio1.dtshr -acodec alac audio1.m4a
[alac @ 00000000005a4dc0] encoding as 24 bits-per-sample
ffmpeg -i audio2.dtshdma -acodec alac -af "aformat=channel_layouts=7.1(wide)" audio2.m4a
ffmpeg^
-probesize 2147483648 -i video.h264 -i audio1_alac.m4a -i audio2_alac.m4a -i chapters^
-map 0:0 -map 1:0 -map 2:0^
-metadata:s:a:0 language=ger -metadata:s:a:0 handler="DTS-HD High Resolution"^
-metadata:s:a:1 language=eng -metadata:s:a:1 handler="DTS-HD Master Audio"^
-movflags disable_chpl^
-c:v copy -c:a copy^
german_dtshr_to_alac__english_dtshdma_to_alac.m4v 2>> ffmpeg.log
[ipod @ 00000000004f3780] track 1: codec frame size is not set
[ipod @ 00000000004f3780] track 2: codec frame size is not set
[ipod @ 00000000004f3780] 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
[ipod @ 00000000004f3780] pts has no value
_
[ac3 @ 0000000000502b40] Estimating duration from bitrate, this may be inaccurate
仅当我尝试转换以下有损格式时才会弹出:ac3、dts 和 eac3。使用有损 dts(如 DTS-HD 高分辨率)时没问题。
[out_0_0 @ 000000000046bc40] 100 buffers queued in out_0_0, something may be wrong.
仅当我尝试转换无损 TrueHD 时才会弹出,无损 DTS-HD Master Audio 就可以了。
[ipod @ 000000000338c040] track 1: codec frame size is not set
[ipod @ 000000000338c040] track 2: codec frame size is not set
[ipod @ 000000000338c040] 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
[ipod @ 000000000338c040] pts has no value
当我尝试混合所有流时,这些消息始终存在。
当我将时间戳放入容器中的 pts 格式时,它们会消失吗?我可以从 mkv 中提取它们(mkvextract timecodes_v2 input.mkv 0:video.timecodes.txt 1:audio1.timecodes.txt 2:audio2.timecodes.txt 3:sub1.timecodes.txt 4:sub2.timecodes.txt 5:sub3.timecodes.txt 6:sub4.timecodes.txt),但仅限于 timecodes_v2 格式。我可以将 timecodes_v2 转换为 pts 并将它们放入容器中以避免出现这些消息吗?
此致,
菲利克斯
编辑:第一个片段的日志:https://pastebin.com/xWq9U2sN
答案1
我终于解决了。
我只是将视频流直接从一个容器传输到另一个容器:
ffmpeg -i german_dd_to_alac__english_truehd_to_alac.mkv -map 0:0 -c copy german_dd_to_alac__english_truehd_to_alac.m4v
然后做我的事:
ffmpeg^
-i german_dd_to_alac__english_truehd_to_alac.m4v -i audio1.m4a -i audio2.m4a -i sub1.srt^ -map 0:0 -map 1:0 -map 2:0 -map 3:0^
-metadata:s:a:0 language=ger -metadata:s:a:0 handler="Dolby Digital"^
-metadata:s:a:1 language=eng -metadata:s:a:1 handler="Dolby TrueHD"^
-metadata:s:s:0 language=ger -metadata:s:s:0 handler="Deutsch"^ -movflags disable_chpl^ -c:s mov_text -c:v copy -c:a alac^ final.m4v
效果很好。没有 pts 或时间戳错误。我通过指定音频编解码器 -c:a alac 解决了帧大小未设置错误。不知道为什么,但它有效。
“100 个缓冲区在 out_0_0 中排队,可能有问题。”错误仍然存在。如果我也能解决这个问题就太好了。
编辑:应该没问题:https://trac.ffmpeg.org/ticket/7703