以编程方式提取 DVD 字幕
我正在尝试使用程序从未加密的 DVD 中提取字幕,这样我就可以单独保存它们。我知道有一些程序可以做到这一点(例如,我找到了此页面: http: //www.bunkus.org/dvdripping4linux/en/separate/subtitles.html),但我希望能够通过库调用或类似的东西来做到这一点(libdvdread或libdvdnav是否支持这一点),最好使用红宝石。
I'm trying to extract subtitles from unencrypted DVDs with a program, so I can save them seperately. I know there are programs that do that (I found this page for example: http://www.bunkus.org/dvdripping4linux/en/separate/subtitles.html), but I would like to be able to do it with a library call or something like that (do libdvdread or libdvdnav support this), preferably using ruby.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以看看Handbrake,它可以让你提取视频、音频和字幕。
还有手刹手册此处,以及字幕部分此处,可以提供更多信息。
这不是用 Ruby 编写的,但您应该能够从 Ruby 调用 Handbrake CLI,不会出现任何问题。
You can have a look at Handbrake, it allows you to extract video, audio and subtitles.
There is also the Handbrake manual here, and the subtitles section here, that can provide more information.
This isn't in Ruby but you should be able to call the Handbrake CLI from Ruby without any problems.
我不知道有哪个图书馆能够做到这一点。
在 ruby 中你可以调用程序。例如,要获取目录列表,您可以执行
反引号变体为您提供被调用程序的标准输出。
了解文件是否存在
system
变体告诉您被调用程序的返回值是否为0
。使用这两种方法,您几乎可以使用非交互式程序执行任何操作。 http://www.bunkus.org/dvdripping4linux/en/ 中描述的程序split/subtitles.html 似乎适合这种控件。
小心转义给外部程序的参数。如果参数是
"; rm -rf *; ls ".
可能会发生不良情况。I don't know of any library, which would be able to do this.
In ruby you can call programs. For example to get a directory listing you can do
The backtick variant gives you stdout of the calle program.
To know wheter a file exists
The
system
variant tells you whether the return value of the called program was0
.Using this two methods, you can do almost anything with noninteracitve programs. The programs described in http://www.bunkus.org/dvdripping4linux/en/separate/subtitles.html seme to be suitable for this kind of control.
Be carefull with escaping arguments you give to external programs. If an argumend is
"; rm -rf *; ls ".
undesirable things may happen.