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-25-2006, 02:25 PM   #1
kryptobs2000
Member
 
Registered: Dec 2003
Distribution: Slackware
Posts: 306

Rep: Reputation: 30
convert .avi's to play on a dvd player


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.
 
Old 12-25-2006, 03:05 PM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Rep: Reputation: 108Reputation: 108
Hi,

I think mencoder (bandled with mplayer) would do. At this moment, I am learning how to use it. (reading lengthy man pages....)

If you think you can use it, can you please post mini how-to-use here?

Happy Penguins!
 
Old 12-25-2006, 03:19 PM   #3
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Quick search here showed this post. http://www.linuxquestions.org/linux/...dia/AVI_to_DVD

Brian
 
Old 12-25-2006, 03:46 PM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Avidemux has presets for such conversion. It has a GUI, all users input is a couple of mouse clicks.
 
Old 12-25-2006, 04:47 PM   #5
Balarabay1
Member
 
Registered: Feb 2006
Location: Florida
Distribution: SUSE 11.0/x86 KDE
Posts: 334

Rep: Reputation: 30
Use Devede!!!

It works EXTREMELY well!
 
Old 12-26-2006, 12:58 AM   #6
kryptobs2000
Member
 
Registered: Dec 2003
Distribution: Slackware
Posts: 306

Original Poster
Rep: Reputation: 30
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.
 
Old 12-26-2006, 03:52 AM   #7
crashmeister
Senior Member
 
Registered: Feb 2002
Distribution: t2 - trying to anyway
Posts: 2,541

Rep: Reputation: 47
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.
 
Old 01-11-2007, 05:09 PM   #8
kryptobs2000
Member
 
Registered: Dec 2003
Distribution: Slackware
Posts: 306

Original Poster
Rep: Reputation: 30
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.
 
Old 01-11-2007, 11:23 PM   #9
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
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

Last edited by dive; 01-12-2007 at 04:22 AM.
 
  


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
which DVD player can play DVD from hard drive *and* support DVD Menu ? tho_x_tran Linux - Software 16 11-16-2006 02:00 PM
burning divx/xvid to dvd for play on standalone dvd player blanny Linux - General 0 12-30-2005 09:29 PM
Movie player that can play divx avi's ??? shogun990 SUSE / openSUSE 4 10-16-2005 01:11 PM
Every DVD Player Fails to Play DVD Movie in SuSE 9.2 Pro....Please Help ! ! ! bedi-beparwah SUSE / openSUSE 2 03-14-2005 06:08 PM
is it possible to convert .wav files to cda so i can play it in my car cd player? 627_627 Linux - Newbie 9 07-27-2004 09:45 AM

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

All times are GMT -5. The time now is 07:25 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