Difference between revisions of "Video2dvdiso"

From ArchWiki
Jump to: navigation, search
(Created page with "Category:Scripts (English) Category:Audio/Video (English) A simple Bash script to Convert any Movie to DVD Video's ISO; which can be directly burn't to blank DVD usin...")
 
m (ffmpeg no longer supports "-sameq" switch // script works fine for me by just removing it.)
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category:Scripts (English)]]
+
[[Category:Scripts]]
[[Category:Audio/Video (English)]]
+
[[Category:Audio/Video]]
 +
[[Category:Optical]]
 
A simple Bash script to [[Convert any Movie to DVD Video]]'s ISO; which can be directly burn't to blank DVD using k3b iso burning.
 
A simple Bash script to [[Convert any Movie to DVD Video]]'s ISO; which can be directly burn't to blank DVD using k3b iso burning.
 +
{{Article summary start}}
 +
{{Article summary text|A simple Bash script to Convert '''any Movie to DVD Video ISO'''; this requires '''ffmpeg''' to convert video to dvd compatible video, '''dvdauthor''' to create dvd video structure, '''mkisofs''' to create dvd iso,  '''mplayer''' to test video dvd.iso, '''dvd+rw-tools''' to burn the iso}}
 +
{{Article summary heading|Related}}
 +
{{Article summary wiki|DVD Ripping}}
 +
{{Article summary wiki|Dvd2Avi}}
 +
{{Article summary wiki|MPlayer}}
 +
{{Article summary wiki|Mencoder}}
 +
{{Article summary end}}
  
 
<pre>
 
<pre>
Line 44: Line 53:
 
# Check the file exists   
 
# Check the file exists   
 
input_file=$1   
 
input_file=$1   
if [ ! -e $input_file ]   
+
if [ ! -e "$input_file" ]   
 
then   
 
then   
 
     echo "Input file not found"   
 
     echo "Input file not found"   
Line 52: Line 61:
 
emphasise "Converting AVI to MPG"   
 
emphasise "Converting AVI to MPG"   
 
    
 
    
ffmpeg -i "$1" -y -target ${format}-dvd -sameq -aspect 16:9 "$1.mpg"
+
ffmpeg -i "$1" -y -target ${format}-dvd -aspect 16:9 "$1.mpg"
 
    
 
    
 
if [ $? != 0 ]   
 
if [ $? != 0 ]   
Line 90: Line 99:
 
</pre>
 
</pre>
  
To use the script, copy and paste it into an appropriately named file (such as {{Filename|video2dvdiso.sh}}), and then execute {{Codeline|chmod +x <file>}}.
+
To use the script, copy and paste it into an appropriately named file (such as {{ic|video2dvdiso.sh}}), and then execute {{ic|chmod +x <file>}}.
  
Hopefully the script is quite easy to understand so you can change it as needed. See {{Codeline|man ffmpeg}} {{Codeline|man mkisofs}} {{Codeline|man dvdauthor}} for more information.
+
Hopefully the script is quite easy to understand so you can change it as needed. See {{ic|man ffmpeg}} {{ic|man mkisofs}} {{ic|man dvdauthor}} for more information.
  
 
'''Example usage'''
 
'''Example usage'''

Revision as of 20:03, 17 June 2013

A simple Bash script to Convert any Movie to DVD Video's ISO; which can be directly burn't to blank DVD using k3b iso burning. Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

#!/bin/bash  
# AVI or any video 2 DVD iso Script  
# DvdAuthor 7 and up needs this
export VIDEO_FORMAT=PAL  
# Change to "ntsc" if you'd like to create NTSC disks  
format="pal"  
  
# Check we have enough command line arguments  
if [ $# != 1 ]  
then  
    echo "Usage: $0 <input file>"  
    exit  
fi  
  
# Check for dependencies  
missing=0  
dependencies=( "mencoder" "ffmpeg" "dvdauthor" "mkisofs" )  
for command in ${dependencies[@]}  
do  
    if ! command -v $command &>/dev/null  
    then  
        echo "$command not found"  
        missing=1  
    fi  
done  
  
if [ $missing = 1 ]  
then  
    echo "Please install the missing applications and try again"  
    exit  
fi  
  
function emphasise() {  
    echo ""  
    echo "********** $1 **********"  
    echo ""  
}  
  
# Check the file exists  
input_file=$1  
if [ ! -e "$input_file" ]  
then  
    echo "Input file not found"  
    exit  
fi  
  
emphasise "Converting AVI to MPG"  
  
ffmpeg -i "$1" -y -target ${format}-dvd -aspect 16:9 "$1.mpg"
  
if [ $? != 0 ]  
then  
    emphasise "Conversion failed"  
    exit  
fi  
  
emphasise "Creating DVD contents"  

dvdauthor --title -o dvd -f "$1.mpg"
first=$?  
dvdauthor -o dvd -T  
second=$?  
  
if [ $first != 0 || $second != 0 ]  
then  
    emphasise "DVD Creation failed"  
    exit  
fi  
  
emphasise "Creating ISO image"  
  
mkisofs -dvd-video -o dvd.iso dvd/  
  
if [ $? != 0 ]  
then  
    emphasise "ISO Creation failed"  
    exit  
fi  
  
# Everything passed. Cleanup  
rm -f "$1.mpg"
rm -rf dvd/  
  
emphasise "Success: dvd.iso image created"  

To use the script, copy and paste it into an appropriately named file (such as video2dvdiso.sh), and then execute chmod +x <file>.

Hopefully the script is quite easy to understand so you can change it as needed. See man ffmpeg man mkisofs man dvdauthor for more information.

Example usage

video2dvd.sh video.avi

will result in dvd.iso

To check the dvd.iso will play as dvd or not:

mplayer dvd.iso