我尝试用谷歌搜索一种使用ffmpeg设置字幕流语言的方法,并找到了-slang选项.所以我尝试了以下命令,但立即收到错误:
I tried googling a way to set the language of a subtitle stream with ffmpeg and found the -slang option. So I tried the following command but immediately receive an error:
ffmpeg -i input.avi -i subs.srt -c:a copy -c:s mov_text -slang eng -c:v libx264 -profile:v high -level:v 4.0 output.mp4 ffmpeg version 1.1 Copyright (c) 2000-2013 the FFmpeg developers built on Jul 18 2013 23:00:53 with Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
libavutil 52. 13.100/52. 13.100
libavutil 52. 13.100 / 52. 13.100
libavcodec 54. 86.100/54. 86.100
libavcodec 54. 86.100 / 54. 86.100
libavformat 54. 59.106/54. 59.106
libavformat 54. 59.106 / 54. 59.106
libavdevice 54. 3.102/54. 3.102
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 32.100/3. 32.100
libavfilter 3. 32.100 / 3. 32.100
libswscale 2. 1.103/2. 1.103
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102/0. 17.102
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100/52. 2.100
libpostproc 52. 2.100 / 52. 2.100
无法识别的选项"s语".
Unrecognized option 'slang'.
拆分参数列表时出错:找不到选项
Error splitting the argument list: Option not found
更多搜索后,我发现了使用-metadata命令的另一种方法:
After more googling I found another way to do it using the -metadata command:
ffmpeg -i input.mp4 -i subs.srt -c:a copy -c:v copy -c:s mov_text -metadata:s:s:0 language=eng output.mp4那绝对好用.但这在ffmpeg手册页中没有提到,而-slang是,这使我认为-metadata命令可能已过时或以其他方式不及-slang.
And that works absolutely fine. But this isn't mentioned in the ffmpeg man page, whereas -slang is, which makes me think the -metadata command is maybe outdated or in some other way not as good as -slang.
推荐答案
经过研究,发现了-slang无效的原因.实际上,您使用的是ffmpeg的最新版本,这是一件好事,但是如果文档仍然描述该选项,您可以在 ChangeLog 中找到:
After some research, found the reason why -slang didn't work. In fact you use a recent version of ffmpeg and it's a good thing but if the documentation still describe the option, you can find in the ChangeLog:
version 0.9: ... * -metadata can now be used to set metadata on streams and chapters, e.g. -metadata:s:1 language=eng sets the language of the first stream to 'eng'. This made -vlang/-alang/-slang options redundant, so they were removed.找到命令行示例后,请检查所使用的选项是否在您的ffmpeg版本中.
When you find a command line example, check if the option used are in Your version of ffmpeg.
ffmpeg --help >> ffmpeg-doc.txt-slang选项不存在.
但是,这也证明有关ffmpeg的在线文档有时在代码更改方面是不正确的.
But it also proof that the on-line documentation about ffmpeg is sometime incorrect regarding the code change.
更多推荐
使用ffmpeg设置字幕语言
发布评论