LinuxAnswers DiscussionThis forum is to discuss articles posted to LinuxAnswers.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Shadysoft script, (that I will keep by the way because sometimes it is usefull to use DVD:Rip) joins all the VOB'S into one and does the exact same thing my script does afterwards, but without calculating the best requant factor automatically (it is set to 1.5).
If you are talking about another program to rip VOB's to disk, there is Vobcopy.
Anyhow, I have worked hard and produced a new version of my script. DVRequant version 0.14a.
I am close to go from an "a" to a "b" as in beta, because I trested it a lot and it works well. Let's see you guys trying it.
What's new!
1) It uses a brand new way to show the DVD content to the user (lsdvd). It let's you pick the right title of your choice and right after you can pick the language audio track of your preference. So now I introduce a new dependency: lsdvdrip. (It was worth it)
2) It clean's up after itself a lot now. It erases uneeded files as it goes. Because otherwise it would get up to 22 gigs of space used up for the whole process. Now it asks for 16 gigs instead of 12 but it's just to be sure. I have to measure it better.
3) At the end it creates a DVD structure and authors the movie so it is ready to burn with K3B.
Todo's
The next version will do even more.
1) I want it to check for dependencies and warn the user.
2) I want the DVD created at the end to be auto chaptered with the original chapters. It looked easy and I could have included it in this release, but I did not have the time to test it.
3) I want it to let the user choose more than one audio track. That way the user could keep all the audio track on the original DVD and switch between them with is remote control (on the standalone player).
4) I want to find a way to set a fixed backgroud color for the console while the script is running because some users have problems with my colors, hahahaha.
So here is the new code:
Code:
#! /bin/bash
# DVrequant script
# Will rip a DVD-9 disc with the title and audio of your
# choice and requantize it to fit on a DVD-R 4.7
# Steel_J 2005-01-09
# Requirement: mplayer / libdvdcss / transcode / mjpegtools / dvdauhtor / K3B / lsdvd
#========================================================
# Presentation
clear
version=0.14a
COLOROFF="\033[1;0m" # standart color
COLOR1="\033[1;32m" # green
COLOR2="\033[1;37m" # white
COLOR3="\033[1;36m" # blue
COLOR4="\033[1;31m" # red
echo -e "${COLOR1} ===================="
echo -e "${COLOR4} * DVRequant v${version} *${COLOR1}"
echo -e "${COLOR1} ===================="
echo -e "$COLOR3"
echo "Requirement: mplayer / libdvdcss / transcode / mjpegtools / dvdauhtor / K3B / lsdvd"
#===========================================================================
# Create project folder and choose preferences
echo
echo "We will create a work folder called dv_output in the path of your choice. Make sure you have at least 16 gigabytes of space available."
echo " "
echo -n "Enter the path to create the directory (ex. /home/bobby/video) >"
read -e path
cd $path
mkdir dv_output
#==========================================================================
# Define path to DVD device
echo " "
echo -n "Enter name of your DVD device (ex. /dev/dvd or /dev/hdc) >"
read -e dvd
echo -e "$COLOR4"
#==========================================================================
# Ask the user witch video title he wants to rip from DVD
#video stream sub-section
echo " "
echo "============================================= "
echo "These are all the video titles on the disc"
echo "============================================= "
echo " "
echo -e "$COLOR3"
lsdvd -v $dvd | more
# tcprobe method
# tcprobe -i $dvd -T 1 -H 10 #not implemented 2>&1 | egrep " \[chapters ..\] " > chapters
echo -e "$COLOR4"
echo " "
echo -n "What title do you want to rip? (ex. 1, 2 or 3) >"
read -e title
echo " "
echo "========================= "
echo "You picked title >#" $title
echo "========================= "
lsdvd -t $title | more
echo -e "$COLOR1"
#audio stream sub-section
echo " "
echo "========================================= "
echo "These are all the audio tracks on the disc"
echo "========================================= "
echo " "
lsdvd -t $title -a | cut -c 1-100
echo -e "$COLOR4"
echo " "
echo -n "Enter the language code you wish to rip (ex. en or fr) >"
read -e track
echo -e "$COLOR3"
echo "================================================= "
echo "The DVD will now be ripped, it may take some time."
echo "================================================= "
echo " "
echo -e "$COLOR2"
#==========================================================================
# Rip the DVD
# Rip selected video title
mplayer -dvd-device $dvd dvd://$title -dumpstream -dumpfile $path/dv_output/output.mpg
# Rip selected audio tracks
mplayer -dvd-device $dvd dvd://$title -dumpaudio -alang $track -dumpfile $path/dv_output/lang.ac3
#this can be modified to rip any other languages by replacing "fr" by any other appropriate codes:
echo -e "$COLOR3"
echo " "
echo "====================================== "
echo "You can eject the DVD now if you want."
echo "====================================== "
echo " "
#========================================================================
# De multiplex the video stream and the audio stream (-d2 is for verbosity)
echo -e "$COLOR3"
echo "Demultiplexing streams...."
echo " "
cd $path/dv_output
tcextract -i output.mpg -t vob -x mpeg2 -d2 > output.m2v
tcextract -i output.mpg -a 0 -x ac3 -t mpeg2 -d2 > trash.ac3
# Cleaning up a bit...
rm trash.ac3
rm output.mpg
#============================================================================
# Calculate requant factor { }
#requant_factor = (video_size / (4700000000 - audio_size)) * 1.04
#If you are including more than one audio stream or a subtitle stream, those
#filesizes must also be subtracted from the maximum dvd image size.
echo -e "$COLOR4"
echo " "
echo "================================== "
echo "Calculating best requant factor..."
echo "================================== "
echo "================================== "
echo "The closer to 1.00 the factor is the better."
echo "================================== "
echo " "
vsize=`du -b output.m2v | cut -c 1-10` # video_size
audio=`du -b lang.ac3 | cut -c 1-9` # audio_size0
dvdlessaudio=$((4700000000-$audio))
division=$(echo "scale=2; $vsize/$dvdlessaudio" | bc)
req=$(echo "scale=2; $division*1.05" | bc) # requant_factor
echo " "
echo "====================================== "
echo "Requant factor for this movie is:" "$req"
echo "====================================== "
echo " "
#========================================================================
# Requantize it:
echo -e "$COLOR1"
echo "========================================= "
echo "Requantizing (shrinking) the video stream."
echo "========================================= "
tcrequant -d2 -i output.m2v -o shrinked.m2v -f $req
#========================================================================
# Remultiplex:
echo -e "$COLOR3"
echo " "
echo "====================================== "
echo "Multiplexing audio and video stream(s)."
echo "====================================== "
echo " "
mplex -f 8 -o final.mpg shrinked.m2v lang.ac3
# Cleaning again...
rm lang.ac3
rm shrinked.m2v
#========================================================================
# Re-author it
# This will create a folder named "dv_dvd" and generate inside it a dvd structure -- VIDEO_TS and AUDIO_TS
echo -e "$COLOR4"
echo " "
echo "========================================= "
echo "Authoring and generating a DVD structure."
echo "========================================= "
#mkdir $path/dv_output/dv_dvd
# Populate filesystem
dvdauthor -o dv_dvd final.mpg
# Create IFO files
dvddauthor -o dv_dvd -T
# Last clean up
rm lang.ac3
rm output.m2v
#========================================================================
# End messages
echo -e "$COLOR3"
echo " "
echo "==============================================================================="
echo "Done! Use a DVD burning program (K3B) to burn the "
echo "AUDIO_TS and VIDEO_TS folders created in the folder - dv_dvd -"
echo "==============================================================================="
echo -e "$COLOR2"
exit
==================================
Calculating best requant factor...
==================================
==================================
The closer to 1.00 the factor is the better.
==================================
======================================
Requant factor for this movie is: .93
======================================
=========================================
Requantizing (shrinking) the video stream.
=========================================
[tcrequant] MPEG2 Requantiser by Makira.
[tcrequant] Using 1.000000 as factor.
It says " Requant factor for this movie is: .93 ", but it " [tcrequant] Using 1.000000 as factor. "
Is that how its suppose to be?
B-
Line 236 of the script you posted:
Change:
Quote:
# Create IFO files
dvddauthor -o dv_dvd -T
to
Quote:
# Create IFO files
dvdauthor -o dv_dvd -T
(1 too many "d" 's - I changed my .sh file once I got the error, and ran that 1 command by itself.
Glad it was the last one! )
C-
From a user standpoint, in your TODO list:
Quote:
2) I want the DVD created at the end to be auto chaptered with the original chapters. It looked easy and I could have included it in this release, but I did not have the time to test it.
That would be GREAT!
Nice work though. Look forward to the next version. Now on to k3b for the burn.
-tw
p.s - burning. Any special instructions? I tried burning per the instructions at the
end of the script. No dvd player would read the disc.
Xine showed the movie using the command " xine dvd://~path/dv_dvd/ " with no menu.
No creation of ISO needed?
#! /bin/bash
# DVrequant script
# Will rip a DVD-9 disc with the title and audio of your
# choice and requantize it to fit on a DVD-R 4.7
# Steel_J 2005-01-09
# Requirement: mplayer / libdvdcss / transcode / mjpegtools / dvdauhtor / K3B / lsdvd
#========================================================
# Presentation
clear
version=0.14a
COLOROFF="\033[1;0m" # standart color
COLOR1="\033[1;32m" # green
COLOR2="\033[1;37m" # white
COLOR3="\033[1;36m" # blue
COLOR4="\033[1;31m" # red
echo -e "${COLOR1} ===================="
echo -e "${COLOR4} * DVRequant v${version} *${COLOR1}"
echo -e "${COLOR1} ===================="
echo -e "$COLOR3"
echo "Requirement: mplayer / libdvdcss / transcode / mjpegtools / dvdauhtor / K3B / lsdvd"
#===========================================================================
# Create project folder and choose preferences
echo
echo "We will create a work folder called dv_output in the path of your choice. Make sure you have at least 16 gigabytes of space available."
echo " "
echo -n "Enter the path to create the directory (ex. /home/bobby/video) >"
read -e path
cd $path
mkdir dv_output
#==========================================================================
# Define path to DVD device
echo " "
echo -n "Enter name of your DVD device (ex. /dev/dvd or /dev/hdc) >"
read -e dvd
echo -e "$COLOR4"
#==========================================================================
# Ask the user witch video title he wants to rip from DVD
#video stream sub-section
echo " "
echo "============================================= "
echo "These are all the video titles on the disc"
echo "============================================= "
echo " "
echo -e "$COLOR3"
lsdvd -v $dvd | more
# tcprobe method
# tcprobe -i $dvd -T 1 -H 10 #not implemented 2>&1 | egrep " \[chapters ..\] " > chapters
echo -e "$COLOR4"
echo " "
echo -n "What title do you want to rip? (ex. 1, 2 or 3) >"
read -e title
echo " "
echo "========================= "
echo "You picked title >#" $title
echo "========================= "
lsdvd -t $title | more
echo -e "$COLOR1"
#audio stream sub-section
echo " "
echo "========================================= "
echo "These are all the audio tracks on the disc"
echo "========================================= "
echo " "
lsdvd -t $title -a | cut -c 1-100
echo -e "$COLOR4"
echo " "
echo -n "Enter the language code you wish to rip (ex. en or fr) >"
read -e track
echo -e "$COLOR3"
echo "================================================= "
echo "The DVD will now be ripped, it may take some time."
echo "================================================= "
echo " "
echo -e "$COLOR2"
#==========================================================================
# Rip the DVD
# Rip selected video title
mplayer -dvd-device $dvd dvd://$title -dumpstream -dumpfile $path/dv_output/output.mpg
# Rip selected audio tracks
mplayer -dvd-device $dvd dvd://$title -dumpaudio -alang $track -dumpfile $path/dv_output/lang.ac3
#this can be modified to rip any other languages by replacing "fr" by any other appropriate codes:
echo -e "$COLOR3"
echo " "
echo "====================================== "
echo "You can eject the DVD now if you want."
echo "====================================== "
echo " "
#========================================================================
# De multiplex the video stream and the audio stream (-d2 is for verbosity)
echo -e "$COLOR3"
echo "Demultiplexing streams...."
echo " "
cd $path/dv_output
tcextract -i output.mpg -t vob -x mpeg2 -d2 > output.m2v
tcextract -i output.mpg -a 0 -x ac3 -t mpeg2 -d2 > trash.ac3
# Cleaning up a bit...
rm trash.ac3
rm output.mpg
#============================================================================
# Calculate requant factor { }
#requant_factor = (video_size / (4700000000 - audio_size)) * 1.04
#If you are including more than one audio stream or a subtitle stream, those
#filesizes must also be subtracted from the maximum dvd image size.
echo -e "$COLOR4"
echo " "
echo "================================== "
echo "Calculating best requant factor..."
echo "================================== "
echo "================================== "
echo "The closer to 1.00 the factor is the better."
echo "================================== "
echo " "
vsize=`du -b output.m2v | cut -c 1-10` # video_size
audio=`du -b lang.ac3 | cut -c 1-9` # audio_size0
dvdlessaudio=$((4700000000-$audio))
division=$(echo "scale=2; $vsize/$dvdlessaudio" | bc)
req=$(echo "scale=2; $division*1.05" | bc) # requant_factor
echo " "
echo "====================================== "
echo "Requant factor for this movie is:" "$req"
echo "====================================== "
echo " "
#========================================================================
# Requantize it:
echo -e "$COLOR1"
echo "========================================= "
echo "Requantizing (shrinking) the video stream."
echo "========================================= "
tcrequant -d2 -i output.m2v -o shrinked.m2v -f $req
#========================================================================
# Remultiplex:
echo -e "$COLOR3"
echo " "
echo "====================================== "
echo "Multiplexing audio and video stream(s)."
echo "====================================== "
echo " "
mplex -f 8 -o final.mpg shrinked.m2v lang.ac3
# Cleaning again...
rm lang.ac3
rm shrinked.m2v
#========================================================================
# Re-author it
# This will create a folder named "dv_dvd" and generate inside it a dvd structure -- VIDEO_TS and AUDIO_TS
echo -e "$COLOR4"
echo " "
echo "========================================= "
echo "Authoring and generating a DVD structure."
echo "========================================= "
#mkdir $path/dv_output/dv_dvd
# Populate filesystem
dvdauthor -o dv_dvd final.mpg
# Create IFO files
dvdauthor -o dv_dvd -T
# Last clean up
rm lang.ac3
rm output.m2v
#========================================================================
# End messages
echo -e "$COLOR3"
echo " "
echo "==============================================================================="
echo "Done! Use a DVD burning program (K3B) to burn the "
echo "AUDIO_TS and VIDEO_TS folders created in the folder - dv_dvd -"
echo "==============================================================================="
echo -e "$COLOR2"
exit
It says " Requant factor for this movie is: .93 ", but it " [tcrequant] Using 1.000000 as factor. "
Is that how its suppose to be?
Yes and no. What I mean to say is that DVRequant will never go below the 1.00 value. As 1.00 represents the original stream unmodified and unaltered.
In your case the title you chose does not need requantizing, so it will remain untouched
I will fix it so that requant factor of 1.00 or lower will cause the process to skip to the the next step with a explanation to the user.
Even without requantizing, going through DVRequant still gives you the advantage of choosing the title and the ausio language track you want.
Also, in my experience. Processing the audio/video files in DVRequant makes absolutely sure the output will be compliant with DVDAuthor.
Quote:
p.s - burning. Any special instructions? I tried burning per the instructions at the
end of the script. No dvd player would read the disc.
Xine showed the movie using the command " xine dvd://~path/dv_dvd/ " with no menu.
No creation of ISO needed?
You need to burn the VIDEO_TS folder as a VIDEO DVD project in K3B. Don't burn it as a DATA. It won't ever work.
As you suggested it, I will have the script modified to create a compliant ISO file ready to burn. The only problem is that it requires more diskspace. (Wich is already up to 16 gigs.) But Hard drives being so cheap today it should not impair most people, I have 540 gigs of space so I don't mind.
Secondly there is no menu as explained a few times earlier in this thread. This is not possible yet in Linux. DVRequant takes the main feature and an audio track. That's it. It does not do as DVDShrink does on Windows.
I hope in the future, software able to shrink and clone a whole DVD content will exist for Unix. Many are working on it.
Thanks a bunch for your testing and feedback. It is vital for the devellopement of this program.
What's new! 1) It uses a brand new way to show the DVD content to the user (lsdvd). It let's you pick the right title of your choice and right after you can pick the language audio track of your preference. So now I introduce a new dependency: lsdvdrip. (It was worth it) 2) It clean's up after itself a lot now. It erases uneeded files as it goes. Because otherwise it would get up to 22 gigs of space used up for the whole process. Now it asks for 16 gigs instead of 12 but it's just to be sure. I have to measure it better. 3) At the end it creates a DVD structure and authors the movie so it is ready to burn with K3B.
Nice, gonna try this out soon and let you know how it goes. Thx.
Steel_j:
Thank You. Yes I have used your bash script, ripped with DVD:RIP
followed your script, and It worked fine, excellent, fast, smooth. It said that dvddirgen was not found...I just kept going down with the script and worked first time second time wow three times. may your penquins never be sick, and your hard drive clean.
1) The colors are still bad, but i think you know that. lol.
2) The script gives an error about not being able to find a dvd if there is no dvd in the drive, but then it just keeps going to the next prompt without exiting or asking the person to put in a dvd.
Yeah I know about the error checking flaws when devices are not found.
For now I am concentrating on getting all the features I want running well. Then I will work on failsafe systems and error protocols.
As for the color. Yes I do know but could you tell me what part of the script is hard for you, or wich colors are a problem. Maybe I could fix it faster.
Still don't have enough space for your script Steel_J (the shop said they has trouble building my new computer) for your script, Steel_J, but I've been studying it and using parts of it in a controlled manner. Well done.
I especially like the way you use mplayer instead of cat'ing the VOBs and using tcextract. Saves space of the disc.
But, on line 145, why do you tcextract the sound file to trash.ac3 only to delete it the next second ?
Since we already have the soundfile lang.ac3 from the earlier rip can't we just forget that step altogether ?
Well it does take a lot of space. In the future I will look into that (I wrote it in my todo list).
The reason I trash the default extracted sound is to make sure the user gets the audio he picks out.
Most of the time the process extracts the english track in north america but in some countries it might not, so I am trying to keep this as platform independent as I can.
But you are right. To save space I will look into the command to rip the video stream only if possible.
You won't hear from me for a while, I am travelling down south for 2 weeks, so be patient you all.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.