LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-24-2004, 12:17 PM   #46
kmberry
LQ Newbie
 
Registered: Dec 2004
Posts: 8

Rep: Reputation: 0
dvd9-to-dvd5 w/transcode, dvdrip. dvdshrink.dvdbackup,lxdvdriip, and all else


I tried every program in existence but I still can't shrink and remultiplex the sound. The resulting shrunken file plays good with mplayer but there is no sound.

Last edited by kmberry; 01-15-2005 at 11:20 AM.
 
Old 03-13-2005, 07:13 AM   #47
kmberry
LQ Newbie
 
Registered: Dec 2004
Posts: 8

Rep: Reputation: 0
I see nobody replied to my email. Problem is that nobody ever shrank a dvd using lpcm and it worked. Would anybody please post an example. All I get is noise when I try it. Every dvd I play using mplayer is a 2 track lpcm. Never did see any that had an ac3 format.
 
Old 03-13-2005, 11:32 AM   #48
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359

Original Poster
Blog Entries: 1

Rep: Reputation: 31
First of all.

You don't shrink or requantize a audio track. That is never done.

Only the video get's shrunked. that's it.

DVD movies with LPCM (Wav) format do exists. Wav PCM is a valid DVD compliant audio format.

Now what you need to do is extract the audio like so:

mplayer -vo null -nogui -aid 128 -ao pcm -aofile audio.wav *vob

This will extract any kind of audio to WAV PCM.

You have the choice of leaving it like that or convert it to AC3 stereo:

Like so (you need ffmpeg): ffmpeg -i audio.wav -ac 2 -ab 192 -ar 48000 audio.ac3

Then requantize your video as usual. just make sure you calculate the size of the audio file in the formula like it is demonstrated in my guide.

Then you have to remultiplex it:

WAV > mplex -f 8 -L 48000:2:16 -o final.mpg shrinked.m2v audio.wav

AC3 > mplex -f 8 -o final.mpg shrinked.m2v movie.ac3


That should work. Now I am going on vacation for 10 days so we will see when I get back.
 
Old 03-13-2005, 07:07 PM   #49
kmberry
LQ Newbie
 
Registered: Dec 2004
Posts: 8

Rep: Reputation: 0
I did what you said. My mplayer woukdn't compile anymore because libavcodec won't compile along with ffmpeg anymore with gcc-4, so I used a freshrpms rpm of mplayer which didn't have the -nogui option and an atrpms ffmpeg rpm. I had to change the -aid 128 to -aid 160 because the pcm codec range started with 160. When I tried to play the file mplayer died with this:

Too many audio packets in the buffer: (4096 in 8257536 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
A: 4.9 V: 4.9 A-V: 0.029 ct: 0.048 144/144 17% 5% 0.8% 8 0

I tried -nosound option with mplayer and got this:

Audio: no sound
Starting playback...
VDec: vo config request - 720 x 480 (preferred csp: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [xv] 720x480 => 720x540 Planar YV12
No bind found for key JOY_AXIS2_PLUS
demux: File doesn't contain the selected audio or video stream.
V: 4.9 144/144 10% 1% 0.0% 0 0

I didn't calculate the requantization factor using audio size even though you refered to the equation in your FAQ since your FAQ implies it is possible to use just 1.5. Could this be the problem?

Recently I used StreamDVD to rip a file and the sound came out ac3 and no requantization was needed according to streamanalyze, but the one track I ripped didn't include part 4 of a 4 part movie and the movie dies using ogle in the beginning of part 3. 3 vobs were showing in the resultant VIDEO_TS directory that streamdvd created. This 2 directory rip I burned using yet another FAQ's info : " dvdrecord speed=1 -dao dev=ATA:0,0,0 mydvd.img" and it wouldn't even play in my cd player. I had a hard time recording mp3 files on cd and recently discovered "bashburn" would do it in case anybody has similar problems with their music and wants to burn their mp3s and take the burnt cd to work. Why is ripping dvd files a bummer?
 
Old 03-22-2005, 11:01 AM   #50
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359

Original Poster
Blog Entries: 1

Rep: Reputation: 31
What movie are you ripping exaclty?

This sounds made much more complicated than necessary. I have been ripping, converting to and from any format of video and sound for years on both Linux and Windows.

A/V creation and editing is a technical hobby yes but ripping a DVD is not that hard.

Let's start fresh and simple to help you out:

What is this movie you want to rip.

Then I will guide you step by step.

P.S The 1.5 factor is a good all around value that fits most of the time if you don't want to bother with calculating the right requant factor, but it still has nothing to do with the sound. Sound file size always has to be added to the final video program stream size (M2V) Otherwise you risk ending up with a file that is too large.

Not all movie need requantization, as long as they already fit on a DVD-R 4.7 gig (4.35gb actually or 4384 mb if you prefer.)
 
Old 03-24-2005, 07:29 AM   #51
Vindane
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Fedora
Posts: 117

Rep: Reputation: 15
Problem at step 5....

I just issued this command: mplex -f 8 -o final.mpg shrinked.m2v movie.ac3 and this is what it returns...

" INFO: [mplex] mplex version 1.6.2 (2.2.3 $Date: 2004/01/13 20:45:26 $)
INFO: [mplex] File shrinked.m2v looks like an MPEG Video stream.
INFO: [mplex] File exorcist.ac3 looks like an AC3 Audio stream.
INFO: [mplex] Video stream 0: profile 8 selected - ignoring non-standard options!
INFO: [mplex] Found 1 audio streams and 1 video streams
INFO: [mplex] Selecting dvdauthor DVD output profile
INFO: [mplex] Multiplexing video program stream!
INFO: [mplex] Scanning for header info: Video stream e0 (shrinked.m2v)
INFO: [mplex] VIDEO STREAM: e0
INFO: [mplex] Frame width : 720
INFO: [mplex] Frame height : 480
INFO: [mplex] Aspect ratio : 16:9 display
INFO: [mplex] Picture rate : 29.970 frames/sec
INFO: [mplex] Bit rate : 8153200 bits/sec
INFO: [mplex] Vbv buffer size : 229376 bytes
INFO: [mplex] CSPF : 0
INFO: [mplex] Scanning for header info: AC3 Audio stream 00 (movie.ac3)
INFO: [mplex] AC3 frame size = 1792

INFO: [mplex] AC3 AUDIO STREAM:
INFO: [mplex] Bit rate : 57344 bytes/sec (448 kbit/sec)
INFO: [mplex] Frequency : 48000 Hz
INFO: [mplex] SYSTEMS/PROGRAM stream:
INFO: [mplex] rough-guess multiplexed stream data rate : 8789696
INFO: [mplex] target data-rate specified : 10080000
INFO: [mplex] Setting specified specified data rate: 10080000
INFO: [mplex] Run-in Sectors = 89 Video delay = 13019 Audio delay = 16022
INFO: [mplex] New sequence commences...
INFO: [mplex] Video e0: buf= 237568 frame=000000 sector=00000000
INFO: [mplex] Audio bd: buf= 16384 frame=000000 sector=00000000
INFO: [mplex] Scanned to end AU 164220
INFO: [mplex] Running out...
INFO: [mplex] Video e0: buf= 212355 frame=164220 sector=01852600
INFO: [mplex] Audio bd: buf= 1155 frame=212872 sector=00189220
**ERROR: [mplex] Need to split output but there appears to be no %d in the filename pattern final.mpg


Any ideas on how i can fix this? Thanks!
 
Old 03-24-2005, 08:57 AM   #52
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Try this:

Code:
mplex -f 8 -o final%d.mpg shrinked.m2v movie.ac3
The '%d' tells mplex how to number the output files. So if it's split in 2 pieces, it will be final1.mpg and final2.mpg.
 
Old 03-24-2005, 11:13 AM   #53
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359

Original Poster
Blog Entries: 1

Rep: Reputation: 31
WapCaplet said it all.

The %d is what makes the difference.
 
Old 03-24-2005, 12:38 PM   #54
Vindane
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Fedora
Posts: 117

Rep: Reputation: 15
Yep that did it. That seemed like the most logical at first. But when I tried that on another computer I had, it split it into about 100 little mpeg files. This time it split it into 6 files: final.mpg, final1.mpg, final2.mpg, final3.mpg, final4.mpg, final5mpg. I think it split it into the 6 files because I ripped the whole dvd with menus and all. What's weird is final.mpg and final1.mpg are the same thing. So I just continued the process with final1.mpg-final5.mpg. I'm burning it now so we'll see.
 
Old 03-24-2005, 01:00 PM   #55
Vindane
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Fedora
Posts: 117

Rep: Reputation: 15
Ok it just finished burning and I'm an idiot. I could have swore I read somewhere in the guide that you could rip the menus. Well I didn't have the menus but I did have the 5 videos, represented as chapters (main movie, behind the scenes, intro, etc.). Now when I go back and start over with just the main movie will it keep the proper chapters as it is on the original disc?
 
Old 03-24-2005, 01:29 PM   #56
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
If you are using the 'dvrequant' script that came with tovid version 0.18a or 0.18b, then you can rip one title from the disc, with chapters. Don't use any of the development versions that have been posted here--many of them were hastily-written (mine were, anyway) and probably had lots of bugs.

Presumably, you will be ripping the main feature on the disc, but if you're dealing with multiple main features, you'll have to split it into several discs. The title chapters should be preserved, so that you end up with the same chapters as were in the original disc. I wrote that feature, so if it doesn't work, you can hold me responsible

Development has kind of stalled on tovid, and Steel_J can't really do much since I asked him to hold off until I can finish up some things in 'dvrequant'. A future version of 'dvrequant' will support rudimentary copying of everything on the disc - menus, navigation, and the works, but it probably won't work terribly well for most discs. With currently-available tools, it appears there is no way to extract navigation data (what button goes to what video/menu) from DVDs. Initially, the full-disc 'dvrequant' feature will give you a disc with all the titles, played in sequence, without any menus. If a way is developed to extract the necessary navigation data (someone figures it out and patches 'dvunauthor' to support it), then we will be much closer to full-disc shrinking.
 
Old 03-24-2005, 01:53 PM   #57
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Cybermonkey's GUI

I was just going back through this thread, reading stuff I missed:

Quote:
i just added a 3 click gui (COPY SHRINK BURN) thats all Screen shot http://tinypic.com/la9g6 of what i have so far if it wasn't for you id still be searching for a solution i was using vobcopy and vobstripper but your method works better.
That is sweet! I am totally going to steal your 3-step idea for my tovid GUI--it is exactly the simplifying concept I was looking for. For 'dvrequant', Copy/Shrink/Burn, for the tovid/makemenu/makexml combo, it's Author/Encode/Burn or something similar. If a direct-to-disk feature (for taking video from a V4L device or digital video camera) ever develops in tovid, it could be Capture/Convert/Burn, etc.

What language/API did you write the GUI in? If you get it to work with 'dvrequant', and are willing to GPL it, let me know and I will include it in the next tovid release. I'm even tempted to rewrite your GUI in wxPython, so it'll be consistent with tovid's GUI.
 
Old 03-24-2005, 02:43 PM   #58
Vindane
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Fedora
Posts: 117

Rep: Reputation: 15
Great thanks for the tip about your script! But where do I start to use your script while following this guide? Do i still use DVD::Rip to rip the 5 or 6 VOB's of the main feature?
 
Old 03-24-2005, 08:13 PM   #59
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359

Original Poster
Blog Entries: 1

Rep: Reputation: 31
All right people, as WapCaplet explained, he is writting changes to my DVRequant script in an effort to make it the DVD ripping solution of the TOVID suite.

He asked me to to give him time and that is what's happenning now. If we both try to make devellopment advances separately and at the same time it is very hard to stay coherent and productive.

I put my very best, but limited programming skills into it, but now he has ideas and for now we are going to let him implement them and make a test release.

For all of you out there who want the: " basic functionnal rip the main title and 2 audio tracks of your choice" version of DVDRequant. It's version 0.17b.

It's pretty stable, tried tested and true and It's the one I use until we have something better. (it suits my needs very well)

So here it is for those who want it:

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
 
Old 03-27-2005, 02:54 PM   #60
foxy123
Member
 
Registered: Nov 2004
Distribution: Ubuntu
Posts: 191

Rep: Reputation: 30
I am trying to figure out if I need to follow all the steps from the first post. I've got a DVD which is of 5.7Gb size, but actual movie is only 4.0Gb. All the rest is some extras and trailers which I do not need. So I'd like to make a copy of the main feature and keep a chapter structure: there is a menu in the beginning where you can pick up the chapter you want to watch.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: DVD9 to DVD5 guide Steel_J LinuxAnswers Discussion 331 10-13-2009 01:40 PM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:00 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration