LinuxQuestions.org
Register a domain and help support LQ
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 05-13-2003, 10:46 PM   #1
gwroy20
Member
 
Registered: Mar 2003
Location: New York City
Distribution: Slackware 9.1, FreeBSD 5.2.1, OpenBSD 3.3
Posts: 89

Rep: Reputation: 15
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.
 
Old 05-13-2003, 11:54 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
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
 
Old 05-14-2003, 03:44 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.

Last edited by acid_kewpie; 05-14-2003 at 05:17 AM.
 
Old 05-14-2003, 05:11 AM   #4
gwroy20
Member
 
Registered: Mar 2003
Location: New York City
Distribution: Slackware 9.1, FreeBSD 5.2.1, OpenBSD 3.3
Posts: 89

Original Poster
Rep: Reputation: 15
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
 
Old 05-14-2003, 05:15 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.

Last edited by acid_kewpie; 05-14-2003 at 05:17 AM.
 
Old 05-14-2003, 05:34 AM   #6
gwroy20
Member
 
Registered: Mar 2003
Location: New York City
Distribution: Slackware 9.1, FreeBSD 5.2.1, OpenBSD 3.3
Posts: 89

Original Poster
Rep: Reputation: 15
For some reason, I haven't been able to connect to http://acidrip.thirtythreeandathird.net/lsdvd.html at all, is your page up?
 
Old 05-14-2003, 05:39 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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...
 
Old 05-14-2003, 06:13 AM   #8
gwroy20
Member
 
Registered: Mar 2003
Location: New York City
Distribution: Slackware 9.1, FreeBSD 5.2.1, OpenBSD 3.3
Posts: 89

Original Poster
Rep: Reputation: 15
Great, I've got everything up and running.

Still can't browse to the page though, must be a problem on my end.
 
Old 05-14-2003, 06:31 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.
 
Old 05-15-2003, 01:26 AM   #10
gwroy20
Member
 
Registered: Mar 2003
Location: New York City
Distribution: Slackware 9.1, FreeBSD 5.2.1, OpenBSD 3.3
Posts: 89

Original Poster
Rep: Reputation: 15
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
 
Old 05-15-2003, 03:37 AM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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...
 
Old 05-15-2003, 05:59 PM   #12
gwroy20
Member
 
Registered: Mar 2003
Location: New York City
Distribution: Slackware 9.1, FreeBSD 5.2.1, OpenBSD 3.3
Posts: 89

Original Poster
Rep: Reputation: 15
Thanks again, will the movie still play in Windows Media Player if I use automatic scaling?
 
Old 05-16-2003, 04:52 AM   #13
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
DVD ripping mailavj Linux - Software 6 05-30-2005 09:08 PM
dvd ripping mouth Mandriva 3 01-21-2005 10:37 AM
dvd ripping kurrupt Linux - Software 8 08-31-2004 10:17 PM
dvd ripping doralsoral Linux - Software 7 05-19-2004 10:15 AM
DVD Player, and DVD/MP3 ripping Roy-Svork Linux - Software 8 05-28-2003 10:32 AM


All times are GMT -5. The time now is 10:57 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration