LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   DVD-ripping question (https://www.linuxquestions.org/questions/linux-software-2/dvd-ripping-question-59694/)

gwroy20 05-13-2003 09:46 PM

DVD-ripping question
 
Is it at all possible to find out the length of a movie before you convert it with mencoder? I'd like to be able to figure out what bitrate I'll need to use with lavc for one or two-pass encoding.
Right now I'm using 3-pass encoding, but the only reason I'm doing the first pass is to find out the length of the movie and the recommended bitrate.

neo77777 05-13-2003 10:54 PM

acidrip from our beloved moderator acid_kewpie uses also written by Chris lsdvd which I believe parses the DVD and calculates the times for chapters. Either email him or wait for him to chime in to shed more light

acid_kewpie 05-14-2003 02:44 AM

oh yes. http://acidrip.thirtythreeandathird.net/lsdvd.html but then my acidrip app itself can automatically suggest a bitrate and everything. well... almost anything. that get_donut() function still isn't going right.

gwroy20 05-14-2003 04:11 AM

Thanks a lot for the reply :) What I meant to say in my first post was that I was looking for a way to do it from a command prompt. My mistake.

I've been doing all of my encoding in Windows and I'm just starting to fool around with it in Linux now, I definitely plan on giving acidrip a go. But for now I'm just trying to be able to do everything I can in a console.

Thanks again

acid_kewpie 05-14-2003 04:15 AM

you didn't look at my site did you? lsdvd is a command line app....

also if you get the latest unrelased version of lsdvd (follow the bleeding-edge link on the acirip page) then it will also atell you which track on the dvd is the main title (well.. the longest title at least) at the moment it only says the track number, but i may well extend that to repeat the length of that track for the sake of it.

gwroy20 05-14-2003 04:34 AM

For some reason, I haven't been able to connect to http://acidrip.thirtythreeandathird.net/lsdvd.html at all, is your page up?

acid_kewpie 05-14-2003 04:39 AM

yep works fine for me.... actually though i did have the address wrong. so i changed it, if you've not tried it again. it's definitely working fine. you can always just check the acidrip project page... http://sf.net/projects/acidrip and get lsdvd from there...

gwroy20 05-14-2003 05:13 AM

Great, I've got everything up and running.

Still can't browse to the page though, must be a problem on my end.

acid_kewpie 05-14-2003 05:31 AM

you might also like to know you can try "mplayer -dvd # -identify" which prints some information, however it's not really parsable and only shows it for one track at a time, which makes searching for the main trakc automatially a horrible task.

gwroy20 05-15-2003 12:26 AM

I want to thank you again for the info acid_kewpie. I'm a total n00b to shell scripting, but I threw together a basic script this morning to try and streamline the process, I haven't really even finished it yet. I've tried it on a few DVDs and it works really well so far. I was just wondering if anyone had any thoughts, suggestions, or criticisms to help a guy that's trying to learn.

#/bin/bash

clear

######################################################################################
echo "Ok, first we need to figure out the length of the movie"
echo
lsdvd
echo
echo "Which title would you like to work with?"
echo -n "Title: "
read TITLE
echo
echo "How long is the selection?"
echo -n "Hours: "
read HOURS
echo -n "Minutes: "
read MIN
echo
LENGTH=$(echo "($HOURS *60) + $MIN" | bc)
echo "The length of the movie is $LENGTH minutes"
echo
#####################################################################################

#####################################################################################
echo "Now I need to know exactly what you're hoping to end up with"
echo

while [ -z $N_SIZE ]
do
echo "How big do you want the movie to be?"
echo "a) 1 CD - 650MB c) 2CDs - 650MB"
echo "b) 1 CD - 700MB d) 2CDs - 700MB"
echo " e)Enter your own size"
echo
echo -n "Your choice: "
read SIZE
echo
case $SIZE in
a) N_SIZE=650 ;;
b) N_SIZE=700 ;;
c) N_SIZE=1300 ;;
d) N_SIZE=1400 ;;
e) echo -n "Enter size: " ; read N_SIZE ;;
*) echo "Please enter either a,b,c,d or e" ; echo
esac
done

echo

while [ -z $N_RATE ]
do
echo "What level of audio compression will you be using?"
echo "Recommended bitrates are: "
echo "a) 96 kbps - lower quality b) 128 kbps - good quality"
echo "c) 160 kbps - better quality d) 192 kbps - best quality"
echo
echo -n "Your choice: "
read RATE
echo
case $RATE in
a) N_RATE=96 ;;
b) N_RATE=128 ;;
c) N_RATE=160 ;;
d) N_RATE=192 ;;
*) echo "Please enter either a,b,c or d" ; echo
esac
done

echo

echo "You chose $SIZE-$N_SIZE MB as your desired output file"
echo "size and $RATE-$N_RATE kbps as your audio sample rate"
echo
echo "What do you want to name the movie? (don't write the .avi)"
echo -n "Name: "
read NAME
########################################################################################

########################################################################################
echo "Now it's time to calculate our video encoding bitrate. You can"
echo "just sit back, relax, and soon you'll be watching your movie :)"
echo
BIT_RATE=$(echo "($N_SIZE * 1024 * 8) / ($LENGTH * 60) - $N_RATE" | bc)
echo "The bitrate we'll be be using is 1888, which should give us an approximatly"
echo "$N_SIZE MB file size with $N_RATE kbps encoded audio. Let's get the ball rolling"
########################################################################################

########################################################################################
clear

cd /space

rm frameno.avi
rm divx2pass.log

nice -+19 \
mencoder dvd://$TITLE \
-aid 128 \
-ovc frameno \
-oac mp3lame -lameopts abr:br=$N_RATE \
-o frameno.avi

nice -+19 \
mencoder dvd://$TITLE \
-aid 128 \
-ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=$BIT_RATE:vpass=1 \
-vf scale=448:336 \
-sws 1 \
-oac copy \
-o /space/"$NAME.avi"

nice -+19
mencoder dvd://$TITLE \
-aid 128 \
-ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=$BIT_RATE:vpass=2 \
-vf scale=448:336 \
-sws 1 \
-oac copy \
-o /space/"$NAME.avi"

rm frameno.avi
rm divx2pass.log
########################################################################################
clear
echo
echo "DONE! Enjoy the movie."
echo

acid_kewpie 05-15-2003 02:37 AM

i'd say to use vop scale not vf scale, and not to use a fixed scale ratio, but make it automatically scale to the correct size... scale=480:-2 for example. also you might want to look into crop detection as it'll bump up the quality of the actual film quite well...

gwroy20 05-15-2003 04:59 PM

Thanks again, will the movie still play in Windows Media Player if I use automatic scaling?

acid_kewpie 05-16-2003 03:52 AM

yes, mplayer just works out the aspect and hardcodes it, the fiel is still the same. actually though mplayer has an "aspect" option in lavc which allows you to set an aspect value inside the avi wrapper, and *NOT* actually scale it at encode time, which improves the quality a fair bit as it still is the exact original ratio and scaled at playback only. this falg is only picked up again by mplayer, so not much use if you want to use other players - of course you can just specify any aspect in a decent divx player, mplayer uses that flag automatically though.


All times are GMT -5. The time now is 05:32 PM.