Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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')
titles=${#cells[@]}

title_num=2
from_cell=1
to_cell=${cell[title_num]}

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.

  title_num=2
  from_cell=1
# 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
  done

# 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
  done
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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