gpt4 book ai didi

ffmpeg - 如何替换 mkv 文件中的两个字幕?

转载 作者:行者123 更新时间:2023-12-04 22:58:24 45 4
gpt4 key购买 nike

我有一个包含 2 个音频和 4 个字幕流的 mkv 文件。第三和第四个字幕流包含错误,所以我提取并更正了它们,但我不知道如何在 mkv 文件中替换它们。我试过了ffmpeg.exe -i .\video.mkv -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -i sub1.srt -i sub2.srt out.mkv
但这给了我错误:

Option map (set input stream mapping) cannot be applied to input url sub2.srt -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Error parsing options for input file sub2.srt.
Error opening input files: Invalid argument

谁能告诉我正确的命令?

最佳答案

选项位置很重要:

ffmpeg [input0 options] -i input0 [input1 options] -i input1 [output options] output

所以你正在尝试申请 -map sub1.srt 的选项.

利用:
ffmpeg -i video.mkv -i sub1.srt -i sub2.srt -map 0 -map -0:s:2 -map -0:s:3 -map 1 -map 2 -c copy out.mkv

选项说明:
  • -map 0 (ffmpeg 文件索引从 0 开始)从 video.mkv 中选择所有流.
  • -map -0:s:2取消选择字幕#3的负面 map 。
  • -map -0:s:3取消选择字幕#4的负面 map 。
  • -map 1sub1.srt 中选择所有流.
  • -map 2sub2.srt 中选择所有流.
  • -c copy stream copies所有流。不重新编码。
  • 关于ffmpeg - 如何替换 mkv 文件中的两个字幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61517954/

    45 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com