Skip to content

Instantly share code, notes, and snippets.

@mara004
Last active March 24, 2025 22:28
Show Gist options
  • Save mara004/b3f0a3535382e232e729614ad4edca87 to your computer and use it in GitHub Desktop.
Save mara004/b3f0a3535382e232e729614ad4edca87 to your computer and use it in GitHub Desktop.
DVD ripping
# see also https://wiki.ubuntuusers.de/DVDs_manuell_rippen/#Komplette-Spur-rippen
lsdvd /dev/sr0 # to show available tracks and their length
mplayer dvd://n -dvd-device /dev/sr0 # to preview a track -- where n is the track number (1-based)
mplayer dvd://n -dvd-device /dev/sr0 -v -dumpstream -dumpfile filename.vob # to rip track
@mara004
Copy link
Author

mara004 commented Dec 28, 2024

Note, don't use mpv (dvd://i --stream-dump=filename.vob).1 It produces corrupt output.2 Use mplayer instead, as shown above.

In particular, with mpv, length info appears to be incorrect, and track recognition seems imprecise (e.g. it may concatenate parts of the menu track, which mplayer doesn't). Moreover, I had a case of A/V track length mismatch, which caused navigation issues in VLC.

On the other hand, mplayer is older and its hardware management seems worse. It caused my DVD drive to rumble loudly and emit a distinct smell during the procedure, whereas mpv behaved more smoothly in this regard.


FWIW, the incorrect length issue can be worked around by passing the output through ffmpeg (as seen in vobfix): ffmpeg -i "filename.vob" -c copy -f vob "filename_fixed.vob". ffmpeg also reported issues with the input.

Footnotes

  1. mpv uses track indices (0-based), whereas mplayer uses track numbers (1-based)

  2. the output does have the stream data and is somewhat playable – but it is technically not quite right

@mara004
Copy link
Author

mara004 commented Dec 28, 2024

For the record, here are the warnings reported by ffmpeg:

[mpeg @ 0x564c23c84000] stream 0 : no PTS found at end of file, duration not set

[vob @ 0x564c23c9c240] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

[vob @ 0x564c23c9c240] Non-monotonous DTS in output stream 0:0; previous: 101815200, current: 101810160; changing to 101815201. This may result in incorrect timestamps in the output file

[vob @ 0x564c23c9c240] Non-monotonous DTS in output stream 0:0; previous: 101815201, current: 101813760; changing to 101815202. This may result in incorrect timestamps in the output file.

There are also a lot of buffer underflows reported, e.g. [vob @ 0x564c23c9c240] buffer underflow st=0 bufi=177419 size=187323

@mara004
Copy link
Author

mara004 commented Dec 28, 2024

Also interesting: https://wiki.videolan.org/VLC_HowTo/Rip_a_DVD/ (will investigate)

@mara004
Copy link
Author

mara004 commented Feb 18, 2025

There's also vobcopy and dvdbackup, which I haven't tried yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment