Roger Braun
Roger Braun

Reputation: 11

Extract DVD subtitles programmatically

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.

Upvotes: 1

Views: 447

Answers (2)

user1661538
user1661538

Reputation:

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.

Upvotes: 1

johannes
johannes

Reputation: 7272

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

files= `ls "#{dir}"`.to_a

The backtick variant gives you stdout of the calle program.

To know wheter a file exists

system("ls \"#{file}\"")

The system variant tells you whether the return value of the called program was 0.

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.

Upvotes: 0

Related Questions