Re-RIP a DVD to extract AVI, MP3 and SRT files

7,784

Solution 1

Ripping the DVD to an MKV file

I suggest you use Handbrake (free, cross platform, open source) to rip the DVDs to an MKV file which contains everything.

Handbrake will already:

  • Create an MKV file if you select MKV from Format under Output Settings
  • Create an H.264-encoded video track of the titles you select from the DVD
  • Create AAC-encoded audio tracks for all languages you select in the Audio tab
  • Create soft-coded subtitles for all tracks you select in the Subtitles tab

Make sure you select Constant Quality for the video, and choose something between 18 and 28 for the quality. Lower means better, but you'll have to experiment on what looks good to you.


After you're done ripping, you can export the various tracks from the MKV file with FFmpeg. You can get a recent version by downloading a static build from the homepage. The static builds are always up-to-date, and if you're on Ubuntu, resist the temptation to use the one that comes with apt-get: It's terribly outdated.

How the extraction works depends on how many audio and subtitle tracks your file has. To get this information later on, you can call ffmpeg -i input.mkv and look at the output.

Here it says:

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, …

That's the video. Look further for audio—here are two audio tracks, one English, one German:

Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, …
Stream #0:2(ger): Audio: aac (mp4a / 0x6134706D), 48000 Hz, …

Finally, you might see subtitles. Here, they're german:

Stream #0:3(ger): Subtitle: text (default)

Now, let's extract them…

Extract video only

First, we'll create an empty video with no audio or subtitles. Here, -an disables the audio, and -sn disables subtitles. Or leave out -sn to keep the subtitles in.

ffmpeg -i input.mkv -c copy -an -sn output.mkv

Your output file will only contain video. You could also change the container here, if you want:

ffmpeg -i input.mkv -c copy -an -sn output.mp4

Extract audio only

This depends on how many audio tracks there are. To create separate audio files, we can do the following, assuming there are two audio tracks. Again, we'll disable video and subtitle output.

ffmpeg -i input.mkv \
-c:a:0 copy -vn -sn output-0.m4a
-c:a:1 copy -vn -sn output-1.m4a

As you can see, the index 0 and 1 specify the first and second audio tracks. If you have more, modify the command as needed and add another line.

Extract subtitles only

To get the subtitles, we'll follow a similar approach—assuming there is one subtitle track:

ffmpeg -i input.mkv -vn -an -c copy output.srt

Or, if there are multiple subtitle tracks:

ffmpeg -i input.mkv \
-c:s:0 copy -vn -an output-0.srt
-c:s:1 copy -vn -an output-1.srt

Solution 2

You can try MakeMKV. It can generate an mkv file with all video, audio and subtitles inside it and it works in Linux. I know you want to have the video, audio and subtitles in separate files, but if you are going to play them in any media player, you can achieve the same if they're inside an mkv file.

The program itself doesn't touch the audio, so it will be the same quality as the iso.

Share:
7,784

Related videos on Youtube

Mark Tower
Author by

Mark Tower

What do you wanna know... all you need is love!

Updated on September 18, 2022

Comments

  • Mark Tower
    Mark Tower almost 2 years

    I have been reading many articles for many days, and finally I found a very useful question in superuser (What tool can I use to to rip DVD movies?)

    I have a large original DVD's collection and they are now in ISO files (I want them for my own, just to learn languages), made with DVDShrink. I want to know what is the best way to get each movie in one folder containing:

    1. The Video in AVI format (or MPEG-4) (original video, don't mind angles) (NO audio)
    2. All Audio files in Mp3 format (Separate from video)
    3. All Subtitles in SRT format

    So I can open the video with the language I want and the subtitle I want (No menus)

    I think this is going to require less size than a 8Gb full copy (with same quality) Isn't it?.
    Note: Better if I can do it in a Linux system, but don't mind it using a virtual windows for it =]

    Thanks.

    • slhck
      slhck over 11 years
      Do you need AVI with MPEG-4 video and MP3 audio? These days it'd be much better in terms of quality and file size to use MP4 files with H.264 video and AAC audio. You could save probably half the space used, at the same quality.
    • Mark Tower
      Mark Tower over 11 years
      @slhck Thank you for answering. I don't know the differences between them (going to seek out). But, the real case is that I need the video without audio, and then all audio files in separate mp3 (or else) format.
    • slhck
      slhck over 11 years
      See: What is a Codec (e.g. DivX?), and how does it differ from a File Format (e.g. MPG)? for the terminology. In your case it'd be best to create a video file that contains the audio, and then just extract the audio later. You can mute the audio from the video if you don't need it. It'd be a hassle to merge them together later—extracting is always easier.
    • Mark Tower
      Mark Tower over 11 years
      @slhck Thanks, going to read :). I updated my question because I think I did not explain it in the greatest way. Hope you understand what I want... and If you think I could get the same results in another way, I hear you with open ears ;) Thanks, really.
  • slhck
    slhck over 11 years
    MakeMKV doesn't re-encode video or audio, does it?
  • Peter
    Peter over 11 years
    No, it just gets them from the DVD or ISO to a MVK file. No conversion done in neither video nor audio files.
  • Mark Tower
    Mark Tower over 11 years
    The best answer I've ever seen. Great! Thank you a lot (awesome your explanation about codecs too in the previous link). Magic.
  • slhck
    slhck over 11 years
    You're welcome! Leave me a comment or ask in chat if you need further help!