BUG: libdvdread Can’t Seek To Block On Second Layer

PROBLEM: When accessing the drive directly, libdvdread cannot seek to blocks that are on the second layer of a DVD.

EXPECTATION: It shouldn’t matter if the device is mounted or not.

RESULT: It does matter, for reasons I haven’t found out yet.

SOLUTION: Mount the device somewhere on the file system. Everything should now work properly, wether you use the block device directly or the mount point.

TO REPRODUCE: Use any application that uses libdvdread. (In this example I’ll use MPlayer.) DO NOT MOUNT THE DEVICE or UNMOUNT THE DEVICE if using some form of automatic mounting for optical discs. Seek to a specific chapter until libdvdread fails.

mplayer -dvd-device /dev/sr0 dvd://[n] -chapter [x]
mplayer -dvd-device /dev/sr0 dvd://[n] -chapter [x+1]
mplayer -dvd-device /dev/sr0 dvd://[n] -chapter [x+2]
etc.

Eventually you’ll get to a point where playback does not start, and libdvdread will give the following error:

libdvdread: Can't seek to block xxxxxxxx

Note that the following will play to the end until a seek attempt is made that attemtps to seek to a block on the second layer:

mplayer -dvd-device /dev/sr0 dvd://[n] -chapter [last-working-chapter]

Mount the device somewhere:

mount -rt udf /dev/sr0 /media/dvd

Now use MPlayer to start play from the first non-working chapter.

mplayer -dvd-device [ /dev/sr0 | /media/dvd ] dvd://[n] \
-chapter [previously-nonworking-chapter]

Playback should be fine.