I have a DVD with cartoons for kids and there are a couple of episodes on every one of them. How can I rip them such that every episode is in a separate file? I think every episode is written as a chapter within one title on the DVD.


To extract the .VOB for Title 2, Chapter 3

Note that '-chapter 3' and '-chapter 3-' will copy from chapter 3 to the end, and if the chapter number you specify is invalid, the option is ignored, and will therefore copy the full title.

# physical DVD
  mplayer dvd://2 -chapter 3-3 -dumpstream -dumpfile ~/3.VOB

# DVD .iso image  
  mplayer dvd://2 -dvd-device "$dvd_iso" -chapter 3-3 -dumpstream -dumpfile ~/3.VOB  

You can use lsdvd to list title, chapter, cell, audio, video, etc for a physical DVD.   However, it doesn't seem(?) to have a way to process a .iso.   You could mount a .iso, if need be.

# count Titles, and count Cells per title. 
# eg. ${cell[1]}      is the Count of Cells for the first title
#     ${cell[titles]} is the Count of Cells for the last title

eval $(lsdvd | sed -n 's/Title: \([0-9]\+\), .* Chapters: \([0-9]\+\), Cells: .*/cells[$((10#\1))]=$((10#\2));/p')


dvdxchap, on the other hand, can process a .iso, but it doesn't list title info.   You can, however, specify the title from which you want chapter info.

# physical DVD
  to_cell="$(dvdxchap -t $title_num  /dev/dvd | sed -n 's/^CHAPTER\([0-9]\+\).*/\1/p' | sed -n '$p')"
# DVD .iso image  
  to_cell="$(dvdxchap -t $title_num "$dvd_iso"| sed -n 's/^CHAPTER\([0-9]\+\).*/\1/p' | sed -n '$p')"   

When you know the title number you want, and know the number of cells, you can dump them in a loop:

# physical DVD
  for ((c=$from_cell; c<$to_cell; c++)) ;do
    mplayer dvd://$title_num -chapter $c-$c -dumpstream -dumpfile ~/$c.VOB

# DVD .iso image  
  for ((c=$from_cell; c<$to_cell; c++)) ;do
    mplayer dvd://$title_num -dvd-device "$dvd_iso" -chapter $c-$c -dumpstream -dumpfile ~/$c.VOB
| improve this answer | |
  • On Ubuntu dvdxchap is part of the ogmtools package. – Eborbob Oct 22 '17 at 14:41

As a script that uses lsdvd, Python, and ffmpeg to extract the Chapters in a DVD to the current directory (extract-chapters.sh):


_genpy () {
    if [ -n "$2" ]; then
        lsdvd -x -Oy -t "$2" "$1"
        lsdvd -x -Oy "$1"

    # Process in Python
    cat <<EOF
for t in lsdvd['track']:
    for c in t['chapter']:
        print '{}\t{}\t{}\t{}'.format(t['vts'], t['ix'], c['ix'], c['length'])

_genpy "$@" 2> /dev/null | python | {
    while read line
        dvd_file=$(printf '%02d' $(echo "$line" | cut -f1))
        dvd_tr=$(echo "$line" | cut -f2)
        dvd_cp=$(echo "$line" | cut -f3)
        dvd_len=$(echo "$line" | cut -f4)
        cat "$1/VIDEO_TS/VTS_${dvd_file}"_*.VOB | ffmpeg -ss "$dvd_pos" -i - -t "$dvd_len" -c:v libvpx -c:a libvorbis -loglevel error "$file_name"
        echo "Created $file_name"
        dvd_pos=$(echo "$dvd_pos + $dvd_len" | bc)


sh extract-chapters.sh PATH_TO_DVD_CONTENTS [TRACK]
| improve this answer | |
  • For the non-POSIX tools, I chose lsdvd, Python, and ffmpeg because all of those came in the distribution's OSS repositories; other tools came from third-party repositories (e.g. dvdbackup, makemkv, etc.). – palswim Jan 16 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.