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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-28-2008, 12:31 AM
|
#1
|
LQ Newbie
Registered: Mar 2008
Posts: 12
Rep:
|
AVI To DVD
So I wanted to write a one click script for converting an AVI file to DVD. The script uses mplayer and dvdauthor. Any input would be appreciated. Yes, I already know I am an amateur script writer, this is only my second attempt.
Code:
var_file_count=$(ls | grep ".avi" -c -i)
var_file_input=$(ls | grep ".avi" -i)
if [ $var_file_count == 0 ]; then
echo "No AVI files found in current directory. Please run script file from directory containg AVI files."
exit 0
elif [ $var_file_count -ge 2 ]; then
echo "More than one AVI file exists in this directory. Please place each AVI in it's own directory."
exit 0
else
var_file_width=$(exiftool -s -ImageWidth -s -s "$var_file_input")
var_file_height=$(exiftool -s -ImageHeight -s -s "$var_file_input")
var_aspect=`echo "scale=2 ; $var_file_width / $var_file_height" | bc`
var_aspect_test=`echo "sale=2 ; $var_aspect / 1.55" | bc`
if [ $var_aspect_test -gt 0 ]; then
var_aspect_input="16/9"
else
var_aspect_input="4/3"
fi
echo "File being proccessed:" $var_file_input
(mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup \
-srate 48000 -af lavcresample=48000 \
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect="$var_aspect_input":\
acodec=ac3:abitrate=192 -ofps 30000/1001 -o output.mpg "$var_file_input")
(dvdauthor -o dvd -x dvd.xml)
echo "Encoding and authoring completed. Please burn conetents of $PWD/dvd/VIDEO_TS to disc."
fi
exit 0
|
|
|
10-28-2008, 02:26 AM
|
#2
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
Well, I would recommend you add some spaces and comments to the script that way you know better what is going on. Have you tested it, does it work. If it does, then great. If not, say so and we'll help debug it.
|
|
|
10-28-2008, 09:33 PM
|
#3
|
LQ Newbie
Registered: Mar 2008
Posts: 12
Original Poster
Rep:
|
Forgot to mention it, but yes it works. The only part that I don't like is that dvdauthor requires a tie into an xml file for the chaptering of the dvd. This is the xml file structure I am using:
Code:
<dvdauthor>
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="output.mpg" chapters="0,10:00,20:00,30:00,40:00,50:00,60:00,70:00,80:00,90:00,100:00,110:00,120:00" />
</pgc>
</titles>
</titleset>
</dvdauthor>
Is there anyway to pass this info to dvdauthor using straight command line?
|
|
|
11-02-2008, 02:22 AM
|
#5
|
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
|
Well for one a script is more readily automated so you can do batches of DVDs.
|
|
|
11-05-2008, 07:06 AM
|
#6
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
Is this just for personal use DVDs? Your dvdauthor setup is very limited, which probably wont play well with some stand alone players. Also, any reason why you're using mencoder? ffmpeg gives a better picture quality / maintains the quality of the source better. Mencoder IMO ends up looking a bit YouTube-ish no matter what options I give it.
Here's my little script for a dvd I recently authored. Which is called by another script passing the parameters for every video. flv, avi, mov, and various other input formats.
I'm my case I was standardizing audio as well. To include a second audio track in supposed 5.1 surround sound (not that I currently have any means to test it). And no delay for the rear channels, so probably pretty lame sounding if I could test it. Sources were either stereo or mono. And I left out a lot of the beta / commented lines. And not quite what I'm wanting yet. When authored it has the none audio, mpeg1 audio (stereo), and ac3 audio (surround) options in ogle. Previously before editing the audio and mplex-ing, it didn't have the none option, but it still defaults to the stereo setup on most players (ogle / xine / mplayer / kaffeine / vlc / ???). And I'm using MP2 for stereo audio to a) make it look different from the ac3 surround sound and to b) overcome mplex's dislike of WAV input. Perhaps it'll take wav input, but I wasn't able to find the parameters needed to make that happen.
$ sh below_script INPUT.AVI DVD_QUALITY.mpeg work_file_prefix
#!/bin/sh
if [ ! $1 ] || [ ! $2 ] || [ ! $3 ]; then
echo "ERROR ##########!!!!!!!!!!@@@@@@@@@@!!!!!!!!!!########## ERROR"
exit 1
fi
SRCFILE=$1
DVDFILE=$2
WORKPRE=$3
VIDFILE=$WORKPRE"_work_video_only.mpg"
M2VFILE=$WORKPRE"_work_video_only.m2v"
WAVFILE=$WORKPRE"_work_audio_only.wav"
CH2FILE=$WORKPRE"_work_audio_stereo.wav"
MP2FILE=$WORKPRE"_work_audio_stereo.mp2"
LEFTFILE=$WORKPRE"_work_audio_left.wav"
RIGHTFILE=$WORKPRE"_work_audio_right.wav"
CENTERFILE=$WORKPRE"_work_audio_center.wav"
LFEFILE=$WORKPRE"_work_audio_lfe.wav"
SURROUNDFILE=$WORKPRE"_work_audio_surround.ac3"
#EXTRACT VIDEO ONLY
ffmpeg -i $SRCFILE -an -sameq -aspect 4:3 -minrate 0 -maxrate 7000 -bufsize 1792 \
-target ntsc-dvd -y $VIDFILE
#CONVERT VIDEO to MPLEX friendly format
ffmpeg -i $VIDFILE -an -sameq -f mpeg2video -vcodec copy -y $M2VFILE
#EXTRACT AUDIO ONLY
ffmpeg -i $SRCFILE -vn -sameq -acodec pcm_s16le -ar 48000 -y $WAVFILE
#CONVERT AUDIO to STEREO and NORMALIZE
# (needed because some inputs were mono)
sox $WAVFILE -r 48000 -c 2 $CH2FILE
normalize-audio $CH2FILE
#CONVERT AUDIO to 5.1 SURROUND
sox $CH2FILE -r 48000 -c 1 $LEFTFILE avg -l
sox $CH2FILE -r 48000 -c 1 $RIGHTFILE avg -r
soxmix $LEFTFILE $RIGHTFILE -r 48000 -c 1 $CENTERFILE
sox -v 0.5 $CENTERFILE $LFEFILE lowp 150
aften -m 0 -b 448 -dsur 2 -acmod 7 \
-ch_fl $LEFTFILE -ch_fc $CENTERFILE -ch_fr $RIGHTFILE \
-ch_sl $LEFTFILE -ch_lfe $LFEFILE -ch_sr $RIGHTFILE \
$SURROUNDFILE
#CONVERT AUDIO to MPLEX friendly format
ffmpeg -i $CH2FILE -sameq -ac 2 -ar 48000 -ab 384k -y $MP2FILE
#MAKE the DVD track with TWO audio tracks
mplex -f 8 -o $DVDFILE $M2VFILE $MP2FILE $SURROUNDFILE
|
|
|
All times are GMT -5. The time now is 04:10 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|