LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxAnswers Discussion
User Name
Password
LinuxAnswers Discussion This forum is to discuss articles posted to LinuxAnswers.

Notices

Reply
 
LinkBack Search this Thread
Old 01-28-2005, 08:09 PM   #76
buzzbiker
Member
 
Registered: Jul 2002
Location: Oregon
Distribution: Fedora Core 7 - vista
Posts: 38

Rep: Reputation: 15

You know what else I have found out? In console type lsdvdrip and it takes off and does everything. Then I opened K3b and found the temp file that it was kept under (video _ts audio_ts)and burnt it. Nothing fancy just a copy that has been requantize, and I'll bet if you use some commands who knows. LOL I'm not sure where I found the imformation, read it on the net some place. Good Luck with ya all have fun.
 
Old 01-28-2005, 10:31 PM   #77
sk545
Member
 
Registered: Aug 2002
Posts: 309

Rep: Reputation: 30
I can't find 'lsdvdrip' anywhere. All i have is 'lsdvd', where did you get 'lsdvdrip' from?
 
Old 01-29-2005, 02:58 AM   #78
ypswes
LQ Newbie
 
Registered: Jan 2005
Posts: 5

Rep: Reputation: 0
how do I delete this post ??? excuse me....

Last edited by ypswes; 01-29-2005 at 03:04 AM.
 
Old 01-29-2005, 03:01 AM   #79
ypswes
LQ Newbie
 
Registered: Jan 2005
Posts: 5

Rep: Reputation: 0
lxdvdrip

I think you are talking about "lxdvdrip", which you can find somewhere here.


http://ubuntuforums.org/archive/index.php/t-7057.html

download here:

http://developer.berlios.de/projects/lxdvdrip/


ypswes
 
Old 01-29-2005, 09:54 PM   #80
sk545
Member
 
Registered: Aug 2002
Posts: 309

Rep: Reputation: 30
i see, thx.
 
Old 02-07-2005, 10:21 PM   #81
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Kubuntu 10.04, Mint 8 and Puppy 4.3.1
Posts: 355
Blog Entries: 1

Original Poster
Rep: Reputation: 31
It will play as 4:3 in your television but with black bars on the top and bottom. (As long as you tell your stand alone DVD to play 16:9 movies as letterbox in it's setup menu)

You cannot get 4:3 out of a widescreen or Panavision movie unles you manipulate ans re-edit the movie yourself witch requires experience and the proper tools.
 
Old 02-07-2005, 10:28 PM   #82
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Kubuntu 10.04, Mint 8 and Puppy 4.3.1
Posts: 355
Blog Entries: 1

Original Poster
Rep: Reputation: 31
Ok , few!!!

New version of DVRequant soon with big changes.

The code is from me and WapCaplet (who did an outstanding job of tuning the quirks out of my code, I can't thank you enough)

WapCaplets helps me out because he wants to use it in Tovid and because he is just an all around good guy

WapCaplet implemented a few things that were on my todo list and he saved me a lot of time. The resulting script is a lot better and that is what I love in open source.

I will list all the new stuff when I release. Still testing. It will let you pick 2 audio tracks if you want. It cleans up a lot more after itself and the colors have been removed due to incompatibility on many platforms. Many other changes...

In a few days, maybe tomorrow.
 
Old 02-08-2005, 02:09 AM   #83
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Kubuntu 10.04, Mint 8 and Puppy 4.3.1
Posts: 355
Blog Entries: 1

Original Poster
Rep: Reputation: 31
New version 0.16b

Lot's of changes and improvements as promised.

As I posted earlier WapCaplet as added a bit of his own code in very useful ways

List of changes and added features:

WapCaplet modifications:

1) Color scheme as been removed as it caused problems on certain systems.
2) Code to fetch the original CHAPTER START TIMES of the movie. (You keep the original chapters of the movie)
3) Error checking that verifies if the work folder already exist.
4) Skipping of requantization when smaller than the 1.00 value is implemented.

My modifications:

5) Fixed a bug in the work folder creation
6) Script now displays a list of optical devices on the user's system for him to choose his DVD device easily.
7) Software now ask user to choose up to 2 audio langage tracks (eg. To keep english and french tracks let's say)
8) Software exits from now on if no work folder or path to the DVD device is entered.(error checking)
9) You now need 14 gig of free space in your work folder.

Next on my list is:

-Quick check whether 'lsdvd' failed, and if so, print an error and exit.

-Create an installer with a readme and the GPL lisence.


Here is the code, enjoy! :

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-02-08

# Additional code from WapCaplet 2005-02-06

# This software is licensed under GPL.

# Requirement: mplayer / libdvdcss / transcode / mjpegtools / dvdauhtor / cdrecord (mkisofs) / lsdvd / K3B

#===========================================================================

# DEFAULTS AND FUNCTION DEFINITIONS

# Take an integer number of seconds and format it as hours:minutes:seconds
# Echoes result to stdout, so in order to use the output as a "return value",
# call the function like this:
#   RETURN_VALUE=$( format_time $NUM_SECONDS )
format_time ()
{
  let "HMS_HOURS=$1 / 3600"
  let "HMS_MINS=( $1 % 3600 ) / 60"
  let "HMS_SECS=$1 % 3600 % 60"

  [[ $HMS_HOURS -lt 10 ]] && HMS_HOURS="0${HMS_HOURS}"
  [[ $HMS_MINS -lt 10 ]] && HMS_MINS="0${HMS_MINS}"
  [[ $HMS_SECS -lt 10 ]] && HMS_SECS="0${HMS_SECS}"

  echo "${HMS_HOURS}:${HMS_MINS}:${HMS_SECS}"
}

# Take a string containing a time (like "02:15:25.3") and
# format it as an integer number of seconds. Fractional seconds
# are truncated. Result is echoed to stdout, so to use the output
# as a "return value", call the function like this:
#   RETURN_VALUE=$( unformat_time $TIME_STRING )
unformat_time ()
{
  HMS_HOURS=$( echo $1 | sed -r -e 's/0?([0-9]+):0?([0-9]+):0?([0-9]+)(\.[0-9])?/\1/' )
  HMS_MINS=$( echo $1 | sed -r -e 's/0?([0-9]+):0?([0-9]+):0?([0-9]+)(\.[0-9])?/\2/' )
  HMS_SECS=$( echo $1 | sed -r -e 's/0?([0-9]+):0?([0-9]+):0?([0-9]+)(\.[0-9])?/\3/' )
  let "TOT_SECONDS=$HMS_HOURS * 3600 + $HMS_MINS * 60 + $HMS_SECS"
  echo $TOT_SECONDS
}

# Retrieve the chapter breaks from the specified track on the DVD.
# Echoes a string to stdout with a list of chapter-start times
# (i.e., "0, 1:53, 15:26, 1:23:15" etc.)
# To use output as a "return value", call the function like this:
#   CHAPTER_START_TIMES=$( get_chapters $TITLE )
get_chapters ()
{
  CH_LIST=$( lsdvd -c -t $1 2>&1 | grep "Chapter:" | \
      sed -r -e 's/^.* Length: ([^,]+).*$/\1/' )
  
  # Assemble the list
  echo -n "0"
  TOTAL_SECS=0
  for CUR_CHAP in $CH_LIST; do
    CUR_SECS=$( unformat_time $CUR_CHAP )
    # Don't insert markers for 0-second chapters
    if [[ $CUR_SECS -gt 0 ]]; then
      let "TOTAL_SECS=$TOTAL_SECS + $CUR_SECS"
      CUR_TIME=$( format_time $TOTAL_SECS )
      echo -n ",$CUR_TIME"
    fi
  done
}

# Presentation

clear
version=0.16b

echo -e "===================="
echo -e "* DVRequant v${version} *"
echo -e "===================="

echo "Requirement: mplayer / libdvdcss / transcode / mjpegtools / dvdauhtor / cdrecord (mkisofs)  / lsdvd / K3B"
echo " "
echo "K3B is optional but recommended"

#============================================================================

# checking for needed software

if ! which mplayer >/dev/null ; then
  echo " "
  echo "mplayer is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which /usr/lib/libdvdcss.so.2 >/dev/null ; then
  echo " "
  echo "libdvdcss is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which transcode >/dev/null ; then
  echo " " 
  echo "transcode is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which mpeg2enc >/dev/null ; then
  echo " "
  echo "mjpegtools is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which dvdauthor >/dev/null ; then
  echo " "
  echo "dvdauthor is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which mkisofs >/dev/null ; then
  echo " "
  echo "cdrecord (mkisofs) is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which lsdvd >/dev/null ; then
  echo " "
  echo "lsdvd is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

#===========================================================================

# Create project folder and choose preferences

echo
echo "We will create a work folder called dv_output in the path of your choice."
echo "Make sure you have at least 14 gigabytes of space available."

echo " "
echo -n "Enter the path to create the directory (ex. /home/bobby/video) >"
 
read -e loc

if [[ ! -d dv_output ]]; then
  mkdir $loc/dv_output
else
  echo "Directory $loc/dv_output already exists. Continuing."
fi

if [ "$loc" = "" ]; then

echo " "
echo "==== Error!  You must choose a folder to work in. Exiting... ===="
echo " "
false; exit;

fi
		    
#==========================================================================

# Define path to DVD device    

echo "============================================="
echo "These are the optical devices on your system."
echo "============================================="

 ls -l /dev/dvd /dev/cdrom*

echo " "
echo -n "Enter name of your DVD device (ex. /dev/dvd or /dev/hdc) >"

read -e dvd

if [ "$dvd" = "" ]; then

echo " "
echo "==== Error!  You must enter a path to your DVD device. Exiting... ===="
echo " "
false; exit;

fi

#==========================================================================

# Ask the user which 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 " "
  
lsdvd  -v $dvd | more

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
                     		       
  
#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
CHAPTER_START_TIMES=$( get_chapters $title )

echo -n "How many audio tracks do you want to rip? (Default is 1) >"

 read aud_number
 
 # Rip selected audio tracks and then video stream
 
            if [ "$aud_number" = "" ]; then
               echo "Default to only one audio tracks..."
	       echo " "
               echo -n "Enter the language code you wish to rip (ex. en or fr) >"
     
               read -e tracka
	       
	       echo "================================================= "
               echo "The DVD will now be ripped, it may take some time."
               echo "================================================= "
               echo " "
               
	       mplayer -dvd-device $dvd dvd://$title -dumpaudio -alang $tracka -dumpfile $loc/dv_output/langa.ac3
	       	       
	       mplayer -dvd-device $dvd dvd://$title -dumpvideo -dumpfile $loc/dv_output/output.m2v 
	       
                # 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 " "
                          echo "================================== "
                          echo "Calculating best requant factor..."
                          echo "================================== "
                          echo "==========================================="
                          echo "The closer to 1.00 the factor is the better."
                          echo "=========================================== "
                          echo " "
 
                                  cd $loc/dv_output
    
                                     vsize=`du -b output.m2v | cut -c 1-10`              # video_size
                                     audioa=`du -b langa.ac3 | cut -c 1-9`              # audio_size for track #1
                                                                                                          
                  
                                     dvdlessaudio=$((4700000000-$audioa))
                                     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 " "
   	       
            fi
	    
	    if [ "$aud_number" = "1" ]; then
	       echo "You have chosen to rip 1 audio tracks..."
	       echo " "
               echo -n "Enter the language code you wish to rip (ex. en or fr) >"
     
               read -e tracka
	       
	        echo "================================================= "
                echo "The DVD will now be ripped, it may take some time."
                echo "================================================= "
                echo " "
               
	       mplayer -dvd-device $dvd dvd://$title -dumpaudio -alang $tracka -dumpfile $loc/dv_output/langa.ac3
	       
	       mplayer -dvd-device $dvd dvd://$title -dumpvideo -dumpfile $loc/dv_output/output.m2v 
	       
	       # 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 " "
                          echo "================================== "
                          echo "Calculating best requant factor..."
                          echo "================================== "
                          echo "==========================================="
                          echo "The closer to 1.00 the factor is the better."
                          echo "=========================================== "
                          echo " "
 
                                  cd $loc/dv_output
    
                                     vsize=`du -b output.m2v | cut -c 1-10`              # video_size
                                     audioa=`du -b langa.ac3 | cut -c 1-9`              # audio_size for track #1
                                                                                                            
                  
                                     dvdlessaudio=$((4700000000-$audioa))
                                     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 " "
	       
            fi
	   
	     if [ "$aud_number" = "2" ]; then
	       echo "You have chosen to rip 2 audio tracks..."
	       echo " "
               echo -n "Enter the language code you wish to rip for track #1 (ex. en or fr) >"
		       
	       read -e tracka
	       
               echo -n "Enter the language code you wish to rip for track #2 (ex. en or fr) >"
     
               read -e trackb
	       
	        echo "================================================= "
                echo "The DVD will now be ripped, it may take some time."
                echo "================================================= "
                echo " "
	       
	       mplayer -dvd-device $dvd dvd://$title -dumpaudio -alang $tracka -dumpfile $loc/dv_output/langa.ac3  

               mplayer -dvd-device $dvd dvd://$title -dumpaudio -alang $trackb -dumpfile $loc/dv_output/langb.ac3  

	       mplayer -dvd-device $dvd dvd://$title -dumpvideo -dumpfile $loc/dv_output/output.m2v 
	       
	       # 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 " "
                          echo "================================== "
                          echo "Calculating best requant factor..."
                          echo "================================== "
                          echo "==========================================="
                          echo "The closer to 1.00 the factor is the better."
                          echo "=========================================== "
                          echo " "
 
                                  cd $loc/dv_output
    
                                     vsize=`du -b output.m2v | cut -c 1-10`              # video_size
                                     audioa=`du -b langa.ac3 | cut -c 1-9`              # audio_size for track #1
                                     audiob=`du -b langb.ac3 | cut -c 1-9`              # audio_size for track #2
                                                                       
                  
                                     dvdlessaudio=$((4700000000-($audioa+$audiob)))
                                     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 " "
	       
	     fi
 

#echo " "
#echo "====================================== "
#echo "You can eject the DVD now if you want."
#echo "====================================== "
#echo " "
  
#========================================================================    

# Requantize it, if necessary:


if [[ $( echo "$req > 1.00" | bc ) == "1" ]]; then
  echo "========================================= "
  echo "Requantizing (shrinking) the video stream."
  echo "========================================= "
  tcrequant -d2 -i output.m2v -o shrinked.m2v -f $req
  
  # Cleaning....  
  rm output.m2v
  else
  echo "========================================= "
	echo "No requantization necessary. Skipping."
  echo "========================================= "
  mv output.m2v shrinked.m2v
fi

#========================================================================
     
# Remultiplex:

echo " "
echo "====================================== "
echo "Multiplexing audio and video stream(s)."
echo "====================================== "
echo " "
 
if [ "$aud_number" = "" ]; then

                 mplex -f 8 -o final.mpg shrinked.m2v langa.ac3
fi

if [ "$aud_number" = "1" ]; then

                 mplex -f 8 -o final.mpg shrinked.m2v langa.ac3 
fi

if [ "$aud_number" = "2" ]; then

                 mplex -f 8 -o final.mpg shrinked.m2v langa.ac3 langb.ac3     
fi
				    
# Cleaning up
				      
rm langa.ac3
rm langb.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 " "
echo "========================================= "
echo "Authoring and generating a DVD structure."
echo "========================================= "

# Populate filesystem
	  
dvdauthor  -t  -o  dv_dvd  -c $CHAPTER_START_TIMES final.mpg
	   
# Create IFO files
dvdauthor -o dv_dvd -T 
		    
# Create DVD Video compliant ISO image
mkisofs -dvd-video -udf -o ready2burn.iso dv_dvd/
	       
#========================================================================       

# End messages

echo " "
echo "==============================================================================="
echo "Done! Use  K3B  to burn the - ready2burn.iso- "
echo " created in the  dv_output folder." 
echo "==============================================================================="
     
exit
 
Old 02-09-2005, 01:01 AM   #84
Emmanuel_uk
Senior Member
 
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,601

Rep: Reputation: 45
To Narc
Quote:
no %d in the filename pattern
Have you tried mplex with the option -M

I had a similar problem with another script using mplex, which stoped
with the same message. I seems to happen with "very" small files.
Maybe in the future scripts will need to determine
from the size of the unrip file whether the option needs to be on or off.
 
Old 02-10-2005, 07:18 PM   #85
narc
Member
 
Registered: Aug 2004
Location: Montréal
Distribution: Linux from scratch
Posts: 64

Rep: Reputation: 15
Regarding subtitles

Quote:
Originally posted by Emmanuel_uk
To Narc
Have you tried mplex with the option -M
Don't have any similar problems for the moment and the burning is done. Sorry.

On another note, I would like to give some insights on subtitles. I have tried spuunmux and spumux with success lately. Contrary to what was hinted in an earlier post, the final subtitles are not permently present on the video stream and can be turned on or off with standard Linux decoders or my tv-top player. I have only used one stream ( = one language) of subtitles so far. Spumux doesn't have a way to "name" the stream with a country code so I either have a "none" when off or "***" when on. I haven't fully explored dvdauthor so something could be triggered there as well to do the task.

The unfortunate part, for those who enjoy using one-stop scripts like Steel_J's, is that I believe there is still some guessing to do about the colors used in the subtitles which cuts the process in two halves.

The structure of those subtitles which spuunmux extracts in the form of *.png files, is consistent throughout a single movie, as expected , but vary from media to media. sometimes 3 or 4 colors) with / without gradient alpha values in the contours. Upon extraction, some of them came out like dark-yellowish letters with green contour which are unusable as-is (I did a simple in-out with such files and they looked ugly on my tv-player). So went on to do so post-processing on each file before sending it back to the final video. Some may prefer to keep some alpha values in and around the letters, which could be trickier to do in a single shot. The final result, of course, can be a matter of taste.

Also, I haven't tested my copies on other tv-top players, but I experience discrepencies on how mplayer and my tv-top display the colors. (I also had issues with xine, shearing some subtitles images for no apparent reason). While mplayer seems to do some on-the-fly transformation for a decent result, I prefer to rely on the colors I see with my png viewer (e.g. the gimp) which were consistent with the results I saw with my tv-top.

To transform the png's, I use the netpbm suite of programs to alter the default color with a one-liner script like so:

Code:
for each in *.png; do pngtopnm -mix $each | <do something> | <do more> ...  | \
pnmtopng -transparent <color> <other dir>/$each; done
Here's an example taken from my latest attempt. in which I add a case where subtitles were yellowish-greeninsh. So I went on with this script:
Code:
pngtopnm -mix $each | pnminvert | ppmchange rgb:ff/80/ff white | ppmchange rgb:80/80/ff rgb:c5/c3/00 | \
pnmtopng -transparent black > out/$each; done
pngtopnm -mix $each will transform each file into netpbm's "anymap" format. The background will be white.
pnminvert will invert the colors from the incoming image. I like white contours around my letters. Inverting changes the white backround into black, so the background won't be affected in the upcoming steps.
rgb:ff/80/ff white changes the contour to white.
ppmchange rgb:80/80/ff rgb:c5/c3/00 changes the letters to a brighter yellow.
pnmtopng -transparent black exports the image back into a png file, transforming the black background into a transparent one.

(I save everything to another directory so that I wont overwrite the originals).

There are many tweaks to be done with netppm in order to get the right colors. Its man pages are invaluable.

I guess none of this would be necessary if I was fluent in Japanese.

Cheers.
 
Old 02-11-2005, 02:33 AM   #86
Emmanuel_uk
Senior Member
 
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,601

Rep: Reputation: 45
cross breeding codes possibility?

Hi,

I wondered if these links could provide you with some inspiration to cross-breed codes?
(Well it is foreign code, but it may speaks for itself, some of it anyway)
The dependencies are not too bad?

Old sh script http://tuxrip.free.fr/tuxcopydvd now superseeded by dvddump
but see mostly
http://tuxrip.free.fr/dvddump/
http://mjules.free.fr/dvddump.htm

According to these authors:
The dvdauthor patch fix the problem from the reset to zero of the clock counter.

(In a .VOB each packet of data (whichever its type) includes a header that contains a SCR value,
that is a software date stamp that allows to order the packets for the the dvd reader.
The date stamp must always increase, however this meaningless but valid case is allowed: reset to zero.
dvdauthor 0.6.10 will display an error on this currently).

Patched rpms
http://mhand.boughias.free.fr/home/index.php?page=Packages.php
http://mjules.free.fr/captures/dvdauthor-0.6.10-1mdkdvddump.src.rpm

Note to Narc:
Below, in the first 2 or 3 pages, there is quite a bit about color palettes for subtitles.
(also note that dvddump handles well? subtitles with streamdvd 0.3 but not streamdvd 0.4)
I do not know (yet) if it is relevant to you, sorry I cannot help more for now.
http://forum.hardware.fr/hardwarefr/...t-36304-14.htm
 
Old 02-11-2005, 10:45 PM   #87
sk545
Member
 
Registered: Aug 2002
Posts: 309

Rep: Reputation: 30
Steel_J: Which version of dvrequant is with the tovid preview release (0.18a)? You have it as 0.16a while the one that comes with tovid preview, is 0.18a...are they both the same?

Anyhow, i tried running the one that came with 0.18a, and it still exits out at:

libdvdcss is not detected
you need it installed. Exiting...

Ofcourse, i have it installed, but i am just saying that the problem is still there.

Thanks!
 
Old 02-14-2005, 05:22 PM   #88
killfire
LQ Newbie
 
Registered: Jan 2005
Distribution: Slackware.
Posts: 16

Rep: Reputation: 0
in your script (which i like very much, thanks for making it) i have one suggestion, which but for terrible scripting abilities, i would implement.

why suggest k3b when growisofs is just as good (i would argue better) suited for the task.

offer an option at the end if the person wants to burn the dvd now, prompt to insert a dvd, and offer the drive indication (in case the drive they use to rip isnt the same as the burner) and then burn it...

i personally get terrible speeds with k3b (8x media on a 16x drive and it burns at 2.5x), and growisofs gets the best speeds the media says it can do (and sometimes better with good media)

here is the command:
Code:
growisofs -dvd-compat -Z /dev/dvd=ready2burn.iso
and thats it, it takes off, and (albeit a lot of output) burns it, and very good speeds.

just my .02,

killfire
 
Old 02-15-2005, 01:56 AM   #89
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Kubuntu 10.04, Mint 8 and Puppy 4.3.1
Posts: 355
Blog Entries: 1

Original Poster
Rep: Reputation: 31
Well 3 questions so 3 answers:


First for Emmanuel_uk:

Tuxrip and tuxcopydvd were very well known to me and I used tuxcopydvd a lot. But it had major problems to implement it on a large scale. Firts of all, it's code is so obscure (although I must say well ordered) that it gave the mainstream users no possibilities to modify it easily. Second it was in french only and I gave up trying to translate it. I am french canadian but there is a lot of text to work on.

All of these tools are in french only and DVDdump, the more recent one requires modified or patched version of dvdauthor depending on which distro it is to be installed on and I find that pretty hard to do for a newbie.

So what I did was create a script that does the same thing but with simpler, shorter code. That is more accessible, easily modifiable and also easier to debug. In other words a monkey could use it.

That is what DVRequant is. If you compare result they are similar, but if you compare the code they are worlds appart.

For SK545:

It's version 0.16b, but I have 0.17b ready to release, see below. WapCaplet probably released it all under Tovid's version number. That's ok. I will still keep a separate version for those who like it standalone.

As for your problem with libdvdcss, well it is simply that your libdvdcss.so.2 file is not in your system path. I fixed the new version 0.17b (look below) to keep going even if can't find the libdvdcss library. Instead of exiting it now warn's the user and keep's running along.

For Killfire:

Actually K3B uses Growisofs and many other tools .K3B is mostly just a frontend to other programs. Also the scope of this script is DVD backup and it would add a extra dependency.

But your Idea is good and I am putting it in my todo list. If I test's out ok I will consider it.

Last edited by Steel_J; 02-15-2005 at 03:25 AM.
 
Old 02-15-2005, 02:01 AM   #90
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Kubuntu 10.04, Mint 8 and Puppy 4.3.1
Posts: 355
Blog Entries: 1

Original Poster
Rep: Reputation: 31
New version 0.17b

Only one major change, but an interesting one. Also some minor visual tweaks and a bugfix.

Fixed a bug that hung the script on some distros when it could not find the dependency "libdvdcss" although it was installed anyway (SK545) .From now on it will warn the user but it will continue it's operations.

libdvdcss is a dependency sometimes not installed in the user path of Linux but somewhere else instead so it is harder to locate.

The major change: In 0.16b the audio tracks were displayed to the user with lsdvd and only let you see the language. The user coud not pick between the dolby stereo 2 channels track and the Dolby 5.1 track of the same language.

I fixed that by using mplayer instead to get the audio info. It now displays the language and the AID (audio ID) number of each tracks. That way the user can choose exactly wich tracks he wants by inputing the AID number instead of the language code (en, de, fr, etc....)

In the next release I would like:

-To make only large size video tilte visible to the user.
-Have an installer
-More error checking.

Here is the code for 0.17b:

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-02-13

# Additional code from WapCaplet 2005-02-06

# This software is licensed under GPL.

# Requirement: mplayer / libdvdcss / transcode / mjpegtools / dvdauhtor / cdrecord (mkisofs) / lsdvd / K3B

#===========================================================================

# DEFAULTS AND FUNCTION DEFINITIONS

# Take an integer number of seconds and format it as hours:minutes:seconds
# Echoes result to stdout, so in order to use the output as a "return value",
# call the function like this:
#   RETURN_VALUE=$( format_time $NUM_SECONDS )
format_time ()
{
  let "HMS_HOURS=$1 / 3600"
  let "HMS_MINS=( $1 % 3600 ) / 60"
  let "HMS_SECS=$1 % 3600 % 60"

  [[ $HMS_HOURS -lt 10 ]] && HMS_HOURS="0${HMS_HOURS}"
  [[ $HMS_MINS -lt 10 ]] && HMS_MINS="0${HMS_MINS}"
  [[ $HMS_SECS -lt 10 ]] && HMS_SECS="0${HMS_SECS}"

  echo "${HMS_HOURS}:${HMS_MINS}:${HMS_SECS}"
}

# Take a string containing a time (like "02:15:25.3") and
# format it as an integer number of seconds. Fractional seconds
# are truncated. Result is echoed to stdout, so to use the output
# as a "return value", call the function like this:
#   RETURN_VALUE=$( unformat_time $TIME_STRING )
unformat_time ()
{
  HMS_HOURS=$( echo $1 | sed -r -e 's/0?([0-9]+):0?([0-9]+):0?([0-9]+)(\.[0-9])?/\1/' )
  HMS_MINS=$( echo $1 | sed -r -e 's/0?([0-9]+):0?([0-9]+):0?([0-9]+)(\.[0-9])?/\2/' )
  HMS_SECS=$( echo $1 | sed -r -e 's/0?([0-9]+):0?([0-9]+):0?([0-9]+)(\.[0-9])?/\3/' )
  let "TOT_SECONDS=$HMS_HOURS * 3600 + $HMS_MINS * 60 + $HMS_SECS"
  echo $TOT_SECONDS
}

# Retrieve the chapter breaks from the specified track on the DVD.
# Echoes a string to stdout with a list of chapter-start times
# (i.e., "0, 1:53, 15:26, 1:23:15" etc.)
# To use output as a "return value", call the function like this:
#   CHAPTER_START_TIMES=$( get_chapters $TITLE )
get_chapters ()
{
  CH_LIST=$( lsdvd -c -t $1 2>&1 | grep "Chapter:" | \
      sed -r -e 's/^.* Length: ([^,]+).*$/\1/' )
  
  # Assemble the list
  echo -n "0"
  TOTAL_SECS=0
  for CUR_CHAP in $CH_LIST; do
    CUR_SECS=$( unformat_time $CUR_CHAP )
    # Don't insert markers for 0-second chapters
    if [[ $CUR_SECS -gt 0 ]]; then
      let "TOTAL_SECS=$TOTAL_SECS + $CUR_SECS"
      CUR_TIME=$( format_time $TOTAL_SECS )
      echo -n ",$CUR_TIME"
    fi
  done
}

# Presentation

clear
version=0.17b

echo -e "===================="
echo -e "* DVRequant v${version} *"
echo -e "===================="

echo "Requirement: mplayer / libdvdcss / transcode / mjpegtools / dvdauhtor / cdrecord (mkisofs)  / lsdvd / K3B"
echo " "
echo "K3B is optional but recommended"
echo " "

#============================================================================

# checking for needed software

if ! which mplayer >/dev/null ; then
  echo " "
  echo "mplayer is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which transcode >/dev/null ; then
  echo " " 
  echo "transcode is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which mpeg2enc >/dev/null ; then
  echo " "
  echo "mjpegtools is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which dvdauthor >/dev/null ; then
  echo " "
  echo "dvdauthor is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which mkisofs >/dev/null ; then
  echo " "
  echo "cdrecord (mkisofs) is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which lsdvd >/dev/null ; then
  echo " "
  echo "lsdvd is not detected";
  echo "you need it installed. Exiting...";
  echo " "
  false; exit;
fi

if ! which /usr/*/libdvdcss.so.2* >/dev/null ; then
  echo " "
  echo "*************************************************************** "
  echo "libdvdcss is not detected, you need it to complete the process.";
  echo "*************************************************************** "
  echo " "
  echo "******************************************************************************** "
  echo "The script will keep going but may exit with errors when trying to read the DVD. "
  echo "******************************************************************************** "
  echo " "
 fi

#===========================================================================

# Create project folder and choose preferences

echo
echo "We will create a work folder called dv_output in the path of your choice."
echo "Make sure you have at least 14 gigabytes of space available."

echo " "
echo -n "Enter the path to create the directory (ex./home/bobby/video) >"
 
read -e loc

if [[ ! -d dv_output ]]; then
  mkdir $loc/dv_output
else
  echo "Directory $loc/dv_output already exists. Continuing."
fi

if [ "$loc" = "" ]; then

echo " "
echo "==== Error!  You must choose a folder to work in. Exiting... ===="
echo " "
false; exit;

fi
		    
#==========================================================================

# Define path to DVD device    

echo "============================================"
echo "These are the optical devices on your system"
echo "============================================"

 ls -l /dev/dvd /dev/cdrom*

echo " "
echo -n "Enter name of your DVD device (ex. /dev/dvd or /dev/hdc) >"

read -e dvd

if [ "$dvd" = "" ]; then

echo " "
echo "==== Error!  You must enter a path to your DVD device. Exiting... ===="
echo " "
false; exit;

fi

#==========================================================================

# Ask the user which 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 " "
  
lsdvd  -v $dvd | more

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
                     		       
  
#audio stream sub-section
 
echo " "
echo "============================================= "
echo "These are all the audio tracks for this title"
echo "============================================= "
echo " "
mplayer -dvd-device /dev/dvd dvd://$title -vo null -ao null -frames 0 -v | grep aid

CHAPTER_START_TIMES=$( get_chapters $title )

echo " "
echo -n "How many audio tracks do you want to rip? (Default is 1) >"


 read aud_number
 
 # Rip selected audio tracks and then video stream
 
            if [ "$aud_number" = "" ]; then
	       echo " "
               echo "Default to only one audio tracks..."
	       echo " "
               echo -n "Enter the audio ID (AID) code you wish to rip (ex. 128) >"
     
               read -e tracka
	       
	       echo "================================================= "
               echo "The DVD will now be ripped, it may take some time"
               echo "================================================= "
               echo " "
               
	       mplayer -dvd-device $dvd dvd://$title -dumpaudio -aid $tracka -dumpfile $loc/dv_output/langa.ac3
	       	       
	       mplayer -dvd-device $dvd dvd://$title -dumpvideo -dumpfile $loc/dv_output/output.m2v 
	       
                # 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 " "
                          echo "================================== "
                          echo "Calculating best requant factor..."
                          echo "================================== "
                          echo "==========================================="
                          echo "The closer to 1.00 the factor is the better"
                          echo "=========================================== "
                          echo " "
 
                                  cd $loc/dv_output
    
                                     vsize=`du -b output.m2v | cut -c 1-10`              # video_size
                                     audioa=`du -b langa.ac3 | cut -c 1-9`              # audio_size for track #1
                                                                                                          
                  
                                     dvdlessaudio=$((4700000000-$audioa))
                                     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 " "
   	       
            fi
	    
	    if [ "$aud_number" = "1" ]; then
	       echo "You have chosen to rip 1 audio tracks..."
	       echo " "
               echo -n "Enter the audio ID (AID) code you wish to rip (ex. 128) >"
     
               read -e tracka
	       
	        echo "================================================= "
                echo "The DVD will now be ripped, it may take some time"
                echo "================================================= "
                echo " "
               
	       mplayer -dvd-device $dvd dvd://$title -dumpaudio -aid $tracka -dumpfile $loc/dv_output/langa.ac3
	       
	       mplayer -dvd-device $dvd dvd://$title -dumpvideo -dumpfile $loc/dv_output/output.m2v 
	       
	       # 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 " "
                          echo "================================== "
                          echo "Calculating best requant factor..."
                          echo "================================== "
                          echo "==========================================="
                          echo "The closer to 1.00 the factor is the better"
                          echo "=========================================== "
                          echo " "
 
                                  cd $loc/dv_output
    
                                     vsize=`du -b output.m2v | cut -c 1-10`              # video_size
                                     audioa=`du -b langa.ac3 | cut -c 1-9`              # audio_size for track #1
                                                                                                            
                  
                                     dvdlessaudio=$((4700000000-$audioa))
                                     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 " "
	       
            fi
	   
	      if [ "$aud_number" = "2" ]; then echo "You have chosen to rip 2 audio tracks..."
	       echo " "
               echo -n "Enter the audio ID (AID) code you wish to rip  for track #1 (ex. 128) >"
		       
	       read -e tracka
	       
               echo -n "Enter the audio ID (AID) code you wish to rip  for track #2 (ex. 128) >"
     
               read -e trackb
	       
	        echo "================================================= "
                echo "The DVD will now be ripped, it may take some time"
                echo "================================================= "
                echo " "
	       
	       mplayer -dvd-device $dvd dvd://$title -dumpaudio -aid $tracka -dumpfile $loc/dv_output/langa.ac3  

               mplayer -dvd-device $dvd dvd://$title -dumpaudio -aid $trackb -dumpfile $loc/dv_output/langb.ac3  

	       mplayer -dvd-device $dvd dvd://$title -dumpvideo -dumpfile $loc/dv_output/output.m2v 
	       
	       # 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 " "
                          echo "================================== "
                          echo "Calculating best requant factor..."
                          echo "================================== "
                          echo "==========================================="
                          echo "The closer to 1.00 the factor is the better"
                          echo "=========================================== "
                          echo " "
 
                                  cd $loc/dv_output
    
                                     vsize=`du -b output.m2v | cut -c 1-10`              # video_size
                                     audioa=`du -b langa.ac3 | cut -c 1-9`              # audio_size for track #1
                                     audiob=`du -b langb.ac3 | cut -c 1-9`              # audio_size for track #2
                                                                       
                  
                                     dvdlessaudio=$((4700000000-($audioa+$audiob)))
                                     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 " "
	       
	     fi
 

#echo " "
#echo "====================================== "
#echo "You can eject the DVD now if you want."
#echo "====================================== "
#echo " "
  
#========================================================================    

# Requantize it, if necessary:

if [[ $( echo "$req > 1.00" | bc ) == "1" ]]; then
  echo "========================================= "
  echo "Requantizing (shrinking) the video stream."
  echo "========================================= "
  tcrequant -d2 -i output.m2v -o shrinked.m2v -f $req
  
  # Cleaning....  
  rm output.m2v
  else
  echo "========================================= "
	echo "No requantization necessary. Skipping."
  echo "========================================= "
  mv output.m2v shrinked.m2v
fi

#========================================================================
     
# Remultiplex:

echo " "
echo "====================================== "
echo "Multiplexing audio and video stream(s)."
echo "====================================== "
echo " "
 
if [ "$aud_number" = "" ]; then

                 mplex -f 8 -o final.mpg shrinked.m2v langa.ac3
fi

if [ "$aud_number" = "1" ]; then

                 mplex -f 8 -o final.mpg shrinked.m2v langa.ac3 
fi

if [ "$aud_number" = "2" ]; then

                 mplex -f 8 -o final.mpg shrinked.m2v langa.ac3 langb.ac3     
fi
				    
# Cleaning up
				      
rm langa.ac3
rm langb.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 " "
echo "========================================= "
echo "Authoring and generating a DVD structure."
echo "========================================= "

# Populate filesystem
	  
dvdauthor  -t  -o  dv_dvd  -c $CHAPTER_START_TIMES final.mpg
	   
# Create IFO files
dvdauthor -o dv_dvd -T 
		    
# Create DVD Video compliant ISO image
mkisofs -dvd-video -udf -o ready2burn.iso dv_dvd/
	       
#========================================================================       

# End messages

echo " "
echo "==============================================================================="
echo "Done! Use  K3B  to burn the - ready2burn.iso- "
echo " created in the  dv_output folder." 
echo "==============================================================================="
     
exit

Last edited by Steel_J; 02-15-2005 at 03:16 AM.
 
  


Reply

Tags
k9copy


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] DVD9 to DVD5 guide Steel_J Linux - Software 62 05-08-2011 10:27 AM
problem at step 5 in "DVD9 to DVD5 guide" Vindane Linux - Software 5 04-24-2005 01:25 PM
DVD backup DVD9 to DVD5 ksgill Linux - Newbie 7 03-05-2005 03:08 PM
DVD9 to DVD5 Klas Linux - Software 2 12-15-2004 12:45 AM
DVD9 to DVD5 Avo Linux - Software 3 10-20-2004 04:49 PM


All times are GMT -5. The time now is 12:47 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration