参考:
https://stackoverflow.com/questions/41086879/mkv-to-mp4-choosing-the-audio-and-subtitles
https://stackoverflow.com/questions/54960500/could-not-find-tag-for-codec-subrip-in-stream-codec-not-currently-supported-in
今天用ffmpeg将mkv文件转码为MP4时,先是遇到了“Default encoder for format mp4 (codec none) is probably disabled”错误,根据前一篇指引,使用 -c:s mov_text 参数,解决了错误,但是转码后文件仍然没有字幕,发现 字幕用的是subrip格式(即srt),用mov_text 转码失效,用-c:s subrip 参数,会提示“Could not find tag for codec subrip in stream, codec not currently supported in container”,根据第二篇文章说法MP4只支持mov_text格式,最后只能用土办法,先提取字幕,再合入:
[sourcecode language=”plain”]
ffmpeg.exe -i "01.mkv" -map 0:s:1 -codec:s:0 srt out.srt
ffmpeg.exe -hwaccel qsv -threads 4 -i "01.mp4" -vf subtitles=out.srt -acodec copy -c:v h264_qsv "01-srt.mp4"
[/sourcecode]
BTW: 第一篇文章里的参数 -map 0:m:language:por 用来在多字幕MKV文件中提取字幕非常好用