Linux - SoftwareThis 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.
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.
I have abunch of .avi movies, how would I go about converting them to play on a dvd player, I don't really care if there's a menu or not, but that would be convenient but not necessary. If they just played back to back that would be fine too.
I'm sure this works, but I've run into a bit of dependency hell installing a few of the required programs and I don't feel like dealing with it atm (it's 2am), I'll give it a go tommarrow though, I'm sure it'll work out. Thanks again for the help guys.
I found a bash script a while back that will do what you want.Itīs rather basic but I never had any trouble at all with it.
Let me know if you're interested - I forgot where I got it but I can email it to you.
I did play around with kmpg and any2dvd but still rather run the script.
I made a python script to take care of everything, thanks though.
If anyone else wants it it's not the best but it works. Just copy this into a file, and make it executable. Then just run it with the file or file's you'd like to convert. It will by default output a AUDIO_TS and VIDEO_TS folder ready for burning. You must have dvdauthor, mplex, and transcode installed as well.
Code:
#! /usr/bin/env python
'''
avi2mpg [OPTION]... [FILE]...
Options
--version
display current version
-noauthor
skip running dvdauthor
-nomplex
skip running mplex
'''
import os
import sys
import getopt
movies = []
options = []
noauthor = 0
nomplex = 0
for file in sys.argv[1:]:
if file[0] == '-':
options.append(file)
continue
else:
movies.append(file[:-4])
for option in options:
if option == '--version':
print 'version: 1.0 -- 1/12/07'
sys.exit()
elif option == '-noauthor':
noauthor = 1
elif option == '-nomplex':
nomplex = 1
noauthor = 1
else:
print '\n\n\nunrecognized option:', option, 'exiting'
sys.exit()
def aviConv(movie):
os.system('transcode -i "' + movie + '.avi" -y ffmpeg --export_prof dvd-ntsc --export_asr 3 -o "' + movie + '" -D0 -s2 -m "' + movie + '.ac3" -J modfps=clonetype=3 --export_fps 29.97')
print '\n\n'
def mplex(movie):
os.system('mplex -f 8 -o "' + movie +'.mpg" "' + movie + '.m2v" "' + movie + '.ac3"')
os.system('rm -f "' + movie + '.m2v"')
os.system('rm -f "' + movie + '.ac3"')
print '\n\n'
def dvdAuthor(movies):
xmlFile = open('author.xml', 'w')
xmlFile.write('<dvdauthor>\n')
xmlFile.write(' <vmgm />\n')
xmlFile.write(' <titleset>\n')
xmlFile.write(' <titles>\n')
xmlFile.write(' <pgc pause="inf">\n')
#write for loop here to construct each .mpg file
for movie in movies:
xmlFile.write(' <vob file="' + movie + '.mpg" />\n')
xmlFile.write(' </pgc>\n')
xmlFile.write(' </titles>\n')
xmlFile.write(' </titleset>\n')
xmlFile.write('</dvdauthor>\n')
xmlFile.close()
os.system('dvdauthor -o ' + os.getcwd() + '/ -x author.xml ')
for movie in movies:
os.system('rm "' + movie + '.mpg"')
os.system('rm -f author.xml')
print '\n\n'
for movie in movies:
aviConv(movie)
if not nomplex:
for movie in movies:
mplex(movie)
if not noauthor:
dvdAuthor(movies)
edit: fixed a couple problems in the script, should be completely fine now.
Last edited by kryptobs2000; 01-12-2007 at 12:37 PM.
Here's one I use. It's developed from the avi2dvd
script somewhere else on LQ. You will need to
edit it for dvd burner device and set it to
ntsc if needed.
Aspect ratio can be 4:3 or 16:9
Code:
#!/bin/bash
function echolightgray {
echo -e "\033[37;0m $1 \033[0m"
}
function echodarkgray {
echo -e "\033[30;1m $1 \033[0m"
}
function echolightblue {
echo -e "\033[34;1m $1 \033[0m"
}
function echolightgreen {
echo -e "\033[32;1m $1 \033[0m"
}
function echolightcyan {
echo -e "\033[36;1m $1 \033[0m"
}
function echolightred {
echo -e "\033[31;1m $1 \033[0m"
}
function echolightpurple {
echo -e "\033[35;1m $1 \033[0m"
}
function echoyellow {
echo -e "\033[33;1m $1 \033[0m"
}
function echoyellownobk {
echo -en "\033[33;1m $1 \033[0m"
}
function echowhite {
echo -e "\033[37;1m $1 \033[0m"
}
function getprojectname
{
echoyellownobk "Name of the DVD project?"
read project
if [[ "$project" == "" ]]; then exit 0; fi
}
function getaviname
{
let cnt=0
echoyellow "Which of the following movies do you want to convert? Type blank line to finish"
echo ""
ls | grep .avi
ls | grep .mpg
ls | grep .wmv
echo ""
while ( true)
do
read avimovie[$cnt]
if [[ ${avimovie[$cnt]} == "" ]]; then break; fi
let cnt=$cnt+1
done
}
function makedir
{
mkdir "DVD-$project" 2>/dev/null
}
function convertvid
{
cd "$workingdir/DVD-$project"
for (( i=0;i<cnt;i++ ))
do
ffmpeg -i ${avimovie[$i]} -y -target pal-dvd video$i.mpg
echolightgreen "Restoring original videofile: ${avimovie[$i]}"
mv ${avimovie[$i]} ../
done
}
function getaspect
{
echoyellownobk "Enter a custom aspect ratio. Enter for auto"
read aspect
}
function author
{
cd "$workingdir/DVD-$project"
rm dvdauthor.xml 2>/dev/null
echo -e "<dvdauthor dest=\"DVD\">
<vmgm />
<titleset>
<titles>" > dvdauthor.xml
if [[ "$aspect" != "" ]]
then echo -e " <video aspect=\"$aspect\" />" >> dvdauthor.xml
fi
echo " <pgc>" >> dvdauthor.xml
for ((i=0;i<cnt;i++))
do
echo -e " <vob file=\"video$i.mpg\"/>" >> dvdauthor.xml
done
echo -e " </pgc>
</titles>
</titleset>
</dvdauthor>" >> dvdauthor.xml
echoyellow "Starting dvdauthor..."
sleep 2
dvdauthor -x dvdauthor.xml 2>/dev/stdout | grep -v "unknown"
}
function createiso
{
cd "$workingdir/DVD-$project/DVD"
echo ""
echoyellow "Creating temporary image"
mkisofs -dvd-video -udf ./ > /tmp/tempdvd.iso 2>mkiso.log
}
function burn
{
cd "$workingdir/DVD-$project/DVD"
echo ""
echoyellow "Burning with growisofs"
sleep 4
growisofs -Z /dev/hdd=/tmp/tempdvd.iso -use-the-force-luke=notray -use-the-force-luke=tty -dvd-compat -speed=8 -overburn -use-the-force-luke=bufsize:32m
aplay -q /mnt/str1/sounds/notify.wav
}
reset
workingdir=`pwd`
getprojectname
getaviname
getaspect
makedir
for (( i=0;i<cnt;i++ ))
do
if [[ ${avimovie[$i]} != "" ]]
then
{
mv ${avimovie[$i]} DVD-$project
}
fi
done
convertvid
author
createiso
a="y"
while [ "$a" == y ]
do
burn
echolightgreen "Another Copy? y/n"
read a
done
rm /tmp/tempdvd.iso
cd "$workingdir"
rm -r DVD-$project
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.