VideoHelp Forum
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. Q: What do you use to convert AVI/MP4 to DVD ISO images on 64-bit Centos 6 Linux?

    In the past, I've successfully used DeVeDe on Ubuntu to convert multiple AVIs or MP4s to a DVD ISO image with menus (and then I burn with K3b).

    However, on Centos 6 (which is the only OS I have), I keep getting the error "Conversion failed. It seems a bug of Mencoder" in my recent installation of DeVeDe 3.21.0.


    I've read everything I could on the net for this common error and tried even the hare-brained suggestions:
    - I've tried various different AVI & MP4 files (it does not appear to be data dependent)
    - I selected the FFMPEG encoder instead of Mencode (no change)
    - I turned off the creation of DVD menus (no change)
    - I eliminated subtitle srt files (no change)
    - I set the Video Rate and Audio Rate in File Properties - Advanced Options to defaults (no change)
    - I moved all the files to the local disk (instead of a USB-mounted hard drive)
    - I ran as root (no change)
    - I rebooted multiple times (no change)
    etc.

    I have no debugging information other than the error message.

    As usual, there's very little Centos (mostly it's Ubuntu anecdotal information) debugging help out there; but even so, the error, it seems, may even have nothing to do with Mencoder (based on bug reports).
    I'm at my wits end and about to give up on DeVeDe.

    But then, that brings me to the question:

    Q: What do you use on Centos 6 to convert multiple AVI and/or MP4 files to a DVD format (either ISO or VIDEO_TS)?

    UPDATE:
    We found the problem was a bad DeVeDe (version 3.21.0) from the Linuxtech repository.

    The solution was simply to use a different DeVeDe (version 3.16.9)
    from the fedora (Pbone) location.


    Last edited by rocksockdoc; 27th Dec 2012 at 04:28. Reason: Added update
    Quote Quote  
  2. I use mencoder + DVDStyler.

    Actually, DVDStyler will handle everything by itself, but using mencoder separately gives me a lot more control and quality over the encode. DVDStyler can give you either stock menus or fully custom menus, and spits out either VIDEO_TS or a neatly packaged ISO.

    I put all sources in a folder, create an empty destination dir, then run a bash script that basically just executes mencoder in a for loop on all the files in the source folder. The script has a nested for loop that runs each video through a 4-pass encode, which may be overkill, but I really value quality

    If you like, I'll post my little script when I'm back at my dev rig.

    Merry Christmas!
    Quote Quote  
  3. Originally Posted by diprotic View Post
    I use mencoder + DVDStyler ... If you like, I'll post my little script when I'm back at my dev rig
    That would be a nice Christmas present!

    Meanwhile, I'll see how to install DVDStyler (although the reviews are lackluster).

    EDIT:
    Unfortunately it's not easy to install properly for Centos 6 (which frowns upon non-yum installations).
    Here's what I tried so far (I'm not sure the next step so I hesitate):

    $ uname -a
    REPORTS: Linux XXX 2.6.32-279.19.1.el6.x86_64 #1 SMP ... x86_64 x86_64 x86_64 GNU/Linux

    $ sudo yum update; sudo yum install dvdstyler
    REPORTS: Nothing to do.

    $ sudo yum list dvdstyler
    REPORTS: Error: No matching Packages to list

    $ yum search all dvdstyler
    REPORTS: No Matches found

    $ alias yumlist='yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo c6-media,\*debug\*,\*-source list'
    $ yumlist dvdstyler
    REPORTS: Error: No matching Packages to list

    $ alias yumsearch='yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo c6-media,\*debug\*,\*-source search'
    $ yumsearch dvdstyler
    REPORTS: No Matches found

    $ alias yumwhatprovides='yum --noplugins --showduplicates --enablerepo \* --disablerepo c6-media,\*-source,\*debug\* whatprovides'
    $ yumwhatprovides "*/dvdstyler"
    REPORTS: No Matches found

    $ yum --noplugins --showduplicates --enablerepo \* --disablerepo c6-media,\*-source,\*debug\* provides "*/dvdstyler"
    REPORTS: No Matches found

    http://pkgs.repoforge.org
    <control f>dvdstyler
    REPORTS: nothing

    http://pkgs.org/search/?keyword=dvdstyler
    REPORTS:
    Fedora 17, RPM Fusion Free: dvdstyler-2.0-0.2.rc1.fc17.i686.rpm - Cross-platform DVD authoring application
    Fedora 17, RPM Fusion Free Updates: dvdstyler-2.3.4-1.fc17.i686.rpm - Cross-platform DVD authoring application
    Fedora 16, RPM Fusion Free: dvdstyler-2.0-0.1.rc1.fc16.i686.rpm - Cross-platform DVD authoring application
    Fedora Rawhide, RPM Fusion Free: dvdstyler-2.3.4-2.fc19.i686.rpm - Cross-platform DVD authoring application

    http://pbone.net advance search limited to CentOS 6, RHEL 6 and Scientific Linux 6:
    REPORTS: Search results for dvdstyler :
    Other ftp.sourceforge.net/pub/sourceforge/d/dv/dvdstyler/dvdstyler/1.8.1/dvdstyler-1.8.1-1pclos2010.i586.rpm
    Other ftp.sourceforge.net/pub/sourceforge/d/dv/dvdstyler/dvdstyler/1.8.0.3/dvdstyler-1.8.0.3-1pclos2010.i586.rpm
    Other ftp.sourceforge.net/pub/sourceforge/d/dv/dvdstyler/dvdstyler/1.8.0.2/dvdstyler-1.8.0.2-1pclos2010.i586.rpm
    Other ftp.sourceforge.net/pub/sourceforge/d/dv/dvdstyler/dvdstyler/1.8.0.1/dvdstyler-1.8.0.1-1pclos2010.i586.rpm
    Other ftp.sourceforge.net/pub/sourceforge/d/dv/dvdstyler/dvdstyler/1.8.0/dvdstyler-1.8.0-1pclos2010.i586.rpm
    Other ftp.sourceforge.net/pub/sourceforge/d/dv/dvdstyler/dvdstyler/1.7.4/dvdstyler-1.7.4_3-1pclos2010.i586.rpm

    I'm looking up how to install DVDStyler from their web page given the results above.
    In addition to the results above, I find this generic procedure for installing DVDStyler and the dvdstyler source code over here.
    Last edited by rocksockdoc; 25th Dec 2012 at 21:40.
    Quote Quote  
  4. Originally Posted by rocksockdoc View Post
    Meanwhile, I'll see how to install DVDStyler (although the reviews are lackluster).
    I would never use it to transcode with; the results are definitely horrible. It uses something like a generic 1-pass ffmpeg transcode. However, I have been very happy with its menu creation, authoring, and ISO creation capabilities.

    I'm not deadset on DVDStyler. Actually, it is pretty clunky and has crashed on me a few times, but I just Ctrl+S after every major edit and it re-loads fine.

    I'm using it as the only cross-platform authoring tool that gives me decent control over the menu design. I'm 100% for a more stable, superior alternative.

    I'm not too surprised that CentOS doesn't keep it in repos. CentOS is, well, enterprise-oriented

    Once I get home I'll post that script. It worked wonders for me, hope it can help someone out.
    Quote Quote  
  5. I'm still pretty fresh with bash scripting, so I'm sure there's a lot of work to be done. But, it gets the job done quite nicely!

    This is set up to *produce* NTSC FILM DVDs with telecine (3:2 pulldown). This means my sources were 24fps progressive and I wanted to preserve that. It's more common to just use native 29.97fps NTSC DVD. If that's the case, be sure to uncomment the proper OFPS setting below, and remove the telecine: option from line 134 (in the -mpegopts string)

    Open to comments, suggestions, critique, etc. Merry Christmas!

    Code:
    #!/bin/bash
    
    # hqdvd.sh - A simple script for transcoding a directory
    # of video files to high-quality, DVD-ready MPEG2 with mencoder.
    # The resulting files will be immediately suitable for authoring
    # with a program like dvdauthor or DVDStyler.
    
    # Usage: ./hqdvd.sh <source dir> <destination dir> <video bitrate> <audio bitrate>
    # Example: ./hqdvd.sh source dest 1700 192
    
    # BE SURE TO OMIT trailing slashes on the source and destination directories!
    # A good bitrate calculator is available at
    # http://dvd-hq.info/bitrate_calculator.php
    
    # Notes:
    #     - This script is purposefully simple, which means it lacks a lot of 
    #       error checking and features of a program like DeVeDe.
    #    - I started this script as a way to make some personal projects a bit
    #      easier; consider it in alpha stages with no guarantee of success.
    #    - I recommend using the latest *stable* mencoder; I ran into some
    #      problems with the nightlies, though your mileage may vary.
    #    - The mencoder settings below are optimized for *quality*, which
    #      means the jobs go much slower than you may expect. This is not
    #      intended for "quick and dirty" jobs. On an i5 MacBook, I encoded
    #      at about halftime; i.e. 1 hour of source took about 2 to encode.
    
    # Uncomment the proper location of your mencoder binary
    #MENCODER=/opt/local/bin/mencoder
    MENCODER=/usr/bin/mencoder
    
    # Be sure to *OMIT* trailing slashes when invoking hqdvd.sh.
    # You could change $1 and $2 to permanent locations to make things simpler.
    SOURCE_DIR=$1
    DEST_DIR=$2
    
    # :TODO: Implement proper bitrate calculation so this becomes unnecessary.
    # For now, a good calculator is available at
    # http://http://dvd-hq.info/bitrate_calculator.php
    
    # Just integers in kiloBITS (NOT bytes) per second (kbps).
    # DVD-Video max is 9800, should be calculated based on the specific project  
    VIDEO_BITRATE=$3
    AUDIO_BITRATE=$4
    
    # mencoder can perform N passes! 2 passes are good, 4 is excellent, more is
    # only suitable for very high motion sources and the most discriminating eye.
    # NOTE: This script will not work with a 1-pass encodes.
    PASSES=4
    
    # Adjust for multi-core systems. Maximum: 8.
    THREADS=8
    
    # Output framerate. Best expressed as an integer or rational number,
    # e.g. 24000/1001 = 23.976 for NTSC FILM. Uncomment the appropriate
    # one for your project.
    
    # NTSC DVD
    #OFPS=30000/1001
    
    # NTSC FILM
    OFPS=24000/1001
    
    # Output video resolution, in pixels, expressed as WIDTH:HEIGHT.
    SCALE=720:480
    # Output video aspect resolution. Most are 16/9, but some are 4/3.
    VASPECT=16/9
    
    # Audio sample rate in hertz (hz).
    SRATE=48000
    # Number of audio channels. Currently untested beyond stereo,
    # but should work with more (limited to AC3 specifications).
    CHANNELS=2
    
    # Just some presentational stuff here, change if you like.
    DIVIDER="---------------------------------------------------"
    COLOR="\033[1;36;40m"
    ECOLOR="\033[0m"
    
    # Directory should contain *only* video files, or mencoder will probably get mad :(
    # This for() loop effectively creates a batch job of all files to encode.
    for SRC in $SOURCE_DIR/*
    do
        # Strip the extension to form the destination filename
        DEST=$DEST_DIR$(basename $SRC ${SRC##*.})mpg
    
        # First pass
        echo $DIVIDER
        echo -e "$COLOR STARTING: Pass 1 of $PASSES on $DEST$ECOLOR"
        echo $DIVIDER
    
        $MENCODER \
        -ovc lavc \
        -nosound \
        -sws 9 \
        -vf scale=$SCALE \
        -lavdopts threads=$THREADS:fast \
        -lavcopts turbo:threads=$THREADS:vcodec=mpeg2video:vpass=1:vbitrate=$VIDEO_BITRATE \
        -mc 0 \
        -o /dev/null \
        $SRC
    
        echo $DIVIDER
        echo -e "$COLOR FINISHED: Pass 1 of $PASSES on $DEST$ECOLOR"
        echo $DIVIDER
    
        # N passes
        # At this point we have already done one pass, so we subtract one
        # from the $PASSES variable
        # NOTE: This script is not intended for one-pass encodes.
        for i in $(seq -s ' ' 1 $((PASSES-1)))
        do
            echo $DIVIDER
            echo -e "$COLOR STARTING: Pass $((i+1)) of $PASSES on $DEST$ECOLOR"
            echo $DIVIDER
    
            $MENCODER \
            -ovc lavc \
            -oac lavc \
            -mc 0 \
            -sws 9 \
            -noskip \
            -vf scale=$SCALE,hqdn3d=2:1:2,pp=ac,harddup \
            -srate $SRATE \
            -af lavcresample=$SRATE,channels=$CHANNELS \
            -channels $CHANNELS \
            -lavdopts threads=$THREADS:fast \
            -lavcopts threads=$THREADS:vpass=3:aspect=$VASPECT:vcodec=mpeg2video:\
    vrc_buf_size=1835:vrc_maxrate=9350:vbitrate=$VIDEO_BITRATE:\
    keyint=18:trell:mbd=2:precmp=3:subcmp=3:cmp=3:\
    dia=-10:predia=-10:preme=1:last_pred=3:cbp:mv0:acodec=ac3_fixed:abitrate=$AUDIO_BITRATE:\
    lmin=1:dc=10:vstrict=0 \
            -of mpeg \
            -mpegopts format=dvd:tsaf:vaspect=$VASPECT:telecine:interleaving2 \
            -ofps $OFPS \
            -o $DEST \
            $SRC
    
            echo $DIVIDER
            echo -e "$COLOR FINISHED: Pass $((i+1)) of $PASSES on $DEST$ECOLOR"
            echo $DIVIDER
        done
    done
    echo $DIVIDER
    echo -e "$COLOR Job finished: $DEST"
    echo $DIVIDER
    Quote Quote  
  6. Oh, and here's a super primitive time calculator script that adds the runtime of all source files using ffmpeg. This makes bitrate calculation much easier. Unfortunately due to my lackluster bash skills this must be executed within the source directory.

    So, the overall DVD creation process goes something like this:
    1. Collect all source video files into a single source directory
    2. Copy timecalc.sh into that directory and execute it: ./timecalc.sh
    3. Decide on an audio bitrate. For speech, 128k is more than enough, but some high quality audio tracks really need 224k+. Take that, and the total runtime in minutes and input it into a bitrate calculator, such as this one to get the target video bitrate.
    4. Create a destination directory, for the resulting MPEG files.
    5. Edit hqdvd.sh to suit your project (e.g. threads, passes, framerate, etc.) Currently defaults to 8 threads, 4 passes, NTSC FILM.
    6. Run ./hqdvd.sh source-dir dest-dir video-bitrate audio-bitrate
    7. Wait for a while
    8. Load the resulting files into an authoring program
    Code:
    #!/bin/bash
    
    IFS=":"
    
    # Initialize time calculation variables
    HRS=0
    MINS=0
    SECS=0
    OUTPUT=0
    
    # Iterate over every m4v file in the current working directory
    for FILE in *.m4v
    do
        # Returns video length in hh:mm:ss format
        TIME=$(ffmpeg -i $FILE 2>&1 | grep Duration | awk '{print $2}' | tr -d , | sed -e "s/\.[0-9]*//g")
    
        # Splits the $TIME variable into $1, $2 and $3 based on the colon (:) delimiter
        set $TIME
    
        # Add the hours, minutes and seconds to each corresponding variable
        HRS=$(echo $HRS + $1 | bc)
        MINS=$(echo $MINS + $2 | bc)
        SECS=$(echo $SECS + $3 | bc)
    done
    
    # Add them all up and output total runtime in minutes
    OUTPUT=$(expr $HRS '*' 60)                            # Convert hours to minutes
    OUTPUT=$(($OUTPUT + $MINS))                            # Add minutes
    OUTPUT=$(($OUTPUT + $(echo $SECS / 60 | bc)))        # Convert seconds to minutes
    echo "Total runtime: $OUTPUT minutes"                # Return output
    Quote Quote  
  7. I saved all that for future use (plus others can use it too!).

    I'm still searching for a GUI-based DVD-authoring tool for 64-bit Centos 6 Linux (which is all that I have available to me).

    I (really) wish DeVeDe worked without that darn error message because that was a simple GUI when I used DeVeDe on Ubuntu.
    But now I'm on Centos, and DeVeDe is just not working (as described separately) for me.
    It would be nice if someone else on 64-bit Centos can confirm whether it's just me - or if it's the DeVeDe program itself.

    To work around the problem, I tried to install DVDStyler on my 64-bit Centos 6 - but that too has an exasperating installation problem as 64-bit libraries do not seem to be available.

    So I plan on trying Bombono next, and then Kdenlive after that, because they come with a GUI.

    But, if that fails, I'll then fall back to the command-line DVD authoring tools on Centos Linux.

    In summary, these seem to be the GUI-based DVD authoring programs out there for Linux (none seem to have easy or working installations on 64-bit Centos 6 though):
    1. DeVeDe (GUI based, very easy to use, converts almost anything to DVD, but DeVeDe doesn't seem to work on Centos 6)
    2. Bombono (GUI based, unknown as yet how easy to use, unknown yet how to install it on Centos 6)
    3. Kdenlive (GUI based, unknown as yet how easy to use, unknown yet how to install on Centos 6)

    In summary, these seem to be the command-line DVD authoring programs out there for Linux (I have not tested them yet):
    1. genisoimage (command line tool, very easy to install on Centos 6)
    2. dvdstyler + mencoder (command line tool, does not yet seem to have an installer for Centos 6)
    3. tovid (command line tool, doesn't seem to have a Centos 6 installer - but Scottro has gotten it to work)

    Is my summary above accurate for the sum total of our DVD authoring options on 64-bit Centos 6?
    Quote Quote  
  8. I tried installing the three GUI-based programs, and I found a problem with most of them which is shown below so others can follow successfully in my footsteps.

    Here is how I (unsuccessfully) installed DeVeDe to author DVDs from AVI or MP4 files:
    Code:
    DeVeDe installation (linuxtech method):
    1. Add the linuxtech repo to /etc/yum.repos.d using steps 2 & 3 below
    2. $ cd /etc/yum.repos.d/
    3. $ sudo wget http://pkgrepo.linuxtech.net/el6/testing/linuxtech.repo
    4. This linuxtech.repo file has the 'linuxtech-release' repo enabled by default.
    5. Since mixing repos is bad, disable linuxtech-release using step 6 below
    6. sudo vi /etc/yum.repos.d/linuxtech.repo ==> Change: linuxtech-release 'enabled=1' to 'enabled=0'
    7. Then see if devede is available:
    8. $ yum --enablerepo=linuxtech-testing info devede
    9. To install devede, [temporarily] enable the 'linuxtech-release' repo for dependencies:
    10. $ yum --enablerepo=linuxtech-testing --enablerepo=linuxtech-release install devede
    11. If this reports dependencies of mplayer and mencoder, install them from elsewhere; then repeat step 10
    12. $ which devede ==> should report /usr/bin/devede & it will show up in your menus
    Since that approach created a DeVeDe that fails every time (on my 64-bit Centos 6 OS anyway), I'll next try this method:
    DeVeDe installation (PBone method):
    Code:
    0. $ sudo yum erase dvdauthor vcdimager mencoder devede libvcdinfo mplayer
    1. http://pbone.net -> advanced search -> CentOS 6, RHEL 6 and Scientific Linux 6 -> devede ==> failed
    2. http://pbone.net -> advanced search -> add Fedora 12 and 13 ==> worked
    3. Downloaded devede-3.16.9-1.fc13.src.rpm
    4. $ rpmbuild --rebuild devede-3.16.9-1.fc13.src.rpm
    5. $ ls /home/USER/rpmbuild/RPMS/noarch/devede-3.16.9-1.el6.noarch.rpm
    6. $ cd /home/USER/rpmbuild/RPMS/noarch/
    7. $ sudo rpm -ivh ./devede-3.16.9-1.el6.noarch.rpm ==> reported dependencies which are fixed in the next step:
    8. sudo yum --enablerepo=rpmforge install dvdauthor mencoder mplayer vcdimager
    9. $ sudo rpm -ivh ./devede-3.16.9-1.el6.noarch.rpm ==> now reports success
    10. $ which devede ==> should report /usr/bin/devede & it will show up in your menus
    This new /usr/bin/devede version 3.16.9 (from Pbone, not from linuxtech) seems to work much better than the
    linuxtech method (which installed a DeVeDe that failed every single time).

    In addition, I tried to install the other two GUI-based programs (but so far, I've failed) due to lack of support for Centos 6.
    Here's my log for installing kdnlive:
    Code:
    ============================================================================
    $ uname -a
    REPORTS: Linux XXX 2.6.32-279.19.1.el6.x86_64 #1 SMP
    
    $ sudo yum update; sudo yum install kdnlive
    REPORTS: Error: Nothing to do.
    
    $ sudo yum list kdnlive
    REPORTS: Error: No matching Packages to list
    
    $ yum search all kdnlive
    REPORTS: No Matches found
    
    $ alias yumlist='yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo c6-media,\*debug\*,\*-source list'
    $ yumlist kdnlive
    REPORTS: Error: No matching Packages to list
    
    $ alias yumsearch='yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo c6-media,\*debug\*,\*-source search'
    $ yumsearch kdnlive
    REPORTS: No Matches found
    
    $ alias yumwhatprovides='yum --noplugins --showduplicates --enablerepo \* --disablerepo c6-media,\*-source,\*debug\* whatprovides'
    $ yumwhatprovides "*/kdnlive"
    REPORTS: No Matches found
    
    $ yum --noplugins --showduplicates --enablerepo \* --disablerepo c6-media,\*-source,\*debug\* provides "*/kdnlive"
    REPORTS: No Matches found
    
    http://pkgs.repoforge.org
    <control f>kdnlive
    REPORTS: nothing
    
    http://pkgs.org/search/?keyword=kdnlive
    REPORTS: Your search did not match any packages.
    ============================================================================
    Here's my log for installing Bombono:
    Code:
    ============================================================================
    $ uname -a
    REPORTS: Linux XXX 2.6.32-279.19.1.el6.x86_64 #1 SMP
    
    $ sudo yum update; sudo yum install bombono
    REPORTS: Error: Nothing to do.
    
    $ sudo yum list bombono
    REPORTS: Error: No matching Packages to list
    
    $ yum search all bombono
    REPORTS: No Matches found
    
    $ alias yumlist='yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo c6-media,\*debug\*,\*-source list'
    $ yumlist bombono
    REPORTS: Error: No matching Packages to list
    
    $ alias yumsearch='yum --noplugins --showduplicates --enablerepo \* --disablerepo \*-source --disablerepo c6-media,\*debug\*,\*-source search'
    $ yumsearch bombono
    REPORTS: No Matches found
    
    $ alias yumwhatprovides='yum --noplugins --showduplicates --enablerepo \* --disablerepo c6-media,\*-source,\*debug\* whatprovides'
    $ yumwhatprovides "*/bombono"
    REPORTS: No Matches found
    
    $ yum --noplugins --showduplicates --enablerepo \* --disablerepo c6-media,\*-source,\*debug\* provides "*/bombono"
    REPORTS: No Matches found
    
    http://pkgs.repoforge.org
    <control f>bombono
    REPORTS: nothing
    
    http://pkgs.org/search/?keyword=bombono
    REPORTS: Debian, Fedora, Mandriva, openSUSE, Slackware, & Ubuntu (but unfortunately, no Centos repositories).
    ============================================================================
    Quote Quote  
  9. Update.

    I spoke with the maintainer of the linuxtech-testing repository (listed in the "rpm -qi devede" command)who reproduced the problem - and - as a result - he removed the devede package from the repository to prevent others from having the same issues.
    The problem is that the ffmpeg program that worked with the older DeVeDe 3.16.9 hasn't been updated to work with the newer DeVeDe 3.21.0 which his repository had.

    So his repository had the new DeVeDe 3.21.0 but the old ffmpeg that only worked with DeVeDe 3.16.9.

    As ffmpeg affects many other programs, he opted to remove DeVeDe 3.21.0 wholly from the repository.

    He pointed me to this thread for details.

    It turns out that most ffmpegs are the older version:
    $ yum --noplugins --showduplicates --enablerepo \* --disablerepo c6-media,\*-source,\*debug\* provides "*/ffmpeg"
    REPORTS: linuxtech-release, naulinux-school, nux-dextop, rpmforge & ATrpms

    Apparently only the ATrpms version is the newer one - but it would be folly to mix repositories if you don't absolutely need it.
    Quote Quote  
  10. Member
    Join Date
    Aug 2016
    Location
    Australia
    Search Comp PM
    Originally Posted by diprotic View Post
    diprotic
    I realise this post is rather old now: I've strengthened diprotic's script it a bit by adding a help option and check for mencoder installation.

    Code:
    #!/bin/bash
    #!/bin/bash -x
    
    # hqdvd.sh - A simple script for transcoding a directory
    # of video files to high-quality, DVD-ready MPEG2 with mencoder.
    # The resulting files will be immediately suitable for authoring
    # with a program like dvdauthor or DVDStyler.
    
    #2016-08-26 AL Added 'help/number-of-arguments' test. Added test for existence
    #              of $MENCODER
    
    # Check that at least 1 argument is given (use basename if script was saved
    # with a different filename).
    function helpme {
    	ME=`basename $0`
    	echo
    	echo Usage: $ME source_dir destination_dir video_bitrate audio_bitrate
    	echo
    	echo Example: $ME source dest 1700 192
    	echo
    }
    case ${1} in
    	-h* | --h* )
    		helpme
    		exit
    		;;
    esac
    if [ $# -lt 4 ]
    then
    	helpme
    	exit
    fi
    
    # BE SURE TO OMIT trailing slashes on the source and destination directories!
    # A good bitrate calculator is available at
    # http://dvd-hq.info/bitrate_calculator.php
    
    # Notes:
    #     - This script is purposefully simple, which means it lacks a lot of 
    #       error checking and features of a program like DeVeDe.
    #    - I started this script as a way to make some personal projects a bit
    #      easier; consider it in alpha stages with no guarantee of success.
    #    - I recommend using the latest *stable* mencoder; I ran into some
    #      problems with the nightlies, though your mileage may vary.
    #    - The mencoder settings below are optimized for *quality*, which
    #      means the jobs go much slower than you may expect. This is not
    #      intended for "quick and dirty" jobs. On an i5 MacBook, I encoded
    #      at about halftime; i.e. 1 hour of source took about 2 to encode.
    
    # Uncomment the proper location of your mencoder binary
    #MENCODER=/opt/local/bin/mencoder
    MENCODER=/usr/bin/mencoder
    
    FLAG=OK
    if [ ! ${MENCODER}     ]; then echo "You need to install $MENCODER"            ; FLAG=NOK ; fi
    #if [ ! `which ffmpeg`  ]; then echo "You need to install ffmpeg"               ; FLAG=NOK ; fi
    #if [ ! `which eyeD3`   ]; then echo "You need to install eyeD3(eyed3 package)" ; FLAG=NOK ; fi
    if [ $FLAG = "NOK"     ]; then echo "Stopping" ; fi
    
    # Be sure to *OMIT* trailing slashes when invoking this script.
    # You could change $1 and $2 to permanent locations to make things simpler.
    SOURCE_DIR=$1
    DEST_DIR=$2
    
    # :TODO: Implement proper bitrate calculation so this becomes unnecessary.
    # For now, a good calculator is available at
    # http://http://dvd-hq.info/bitrate_calculator.php
    
    # Just integers in kiloBITS (NOT bytes) per second (kbps).
    # DVD-Video max is 9800, should be calculated based on the specific project  
    VIDEO_BITRATE=$3
    AUDIO_BITRATE=$4
    
    # mencoder can perform N passes! 2 passes are good, 4 is excellent, more is
    # only suitable for very high motion sources and the most discriminating eye.
    # NOTE: This script will not work with a 1-pass encodes.
    PASSES=4
    
    # Adjust for multi-core systems. Maximum: 8.
    THREADS=3
    
    # Output framerate. Best expressed as an integer or rational number,
    # e.g. 24000/1001 = 23.976 for NTSC FILM. Uncomment the appropriate
    # one for your project.
    
    # NTSC DVD
    #OFPS=30000/1001
    
    # NTSC FILM
    OFPS=24000/1001
    
    # Output video resolution, in pixels, expressed as WIDTH:HEIGHT.
    SCALE=720:480
    # Output video aspect resolution. Most are 16/9, but some are 4/3.
    VASPECT=16/9
    
    # Audio sample rate in hertz (hz).
    SRATE=48000
    # Number of audio channels. Currently untested beyond stereo,
    # but should work with more (limited to AC3 specifications).
    CHANNELS=2
    
    # Just some presentational stuff here, change if you like.
    DIVIDER="---------------------------------------------------"
    COLOR="\033[1;36;40m"
    ECOLOR="\033[0m"
    
    # Directory should contain *only* video files, or mencoder will probably get mad :(
    # This for() loop effectively creates a batch job of all files to encode.
    for SRC in $SOURCE_DIR/*
    do
        # Strip the extension to form the destination filename
        DEST=$DEST_DIR$(basename $SRC ${SRC##*.})mpg
    
        # First pass
        echo $DIVIDER
        echo -e "$COLOR STARTING: Pass 1 of $PASSES on $DEST$ECOLOR"
        echo $DIVIDER
    
        $MENCODER \
        -ovc lavc \
        -nosound \
        -sws 9 \
        -vf scale=$SCALE \
        -lavdopts threads=$THREADS:fast \
        -lavcopts turbo:threads=$THREADS:vcodec=mpeg2video:vpass=1:vbitrate=$VIDEO_BITRATE \
        -mc 0 \
        -o /dev/null \
        $SRC
    
        echo $DIVIDER
        echo -e "$COLOR FINISHED: Pass 1 of $PASSES on $DEST$ECOLOR"
        echo $DIVIDER
    
        # N passes
        # At this point we have already done one pass, so we subtract one
        # from the $PASSES variable
        # NOTE: This script is not intended for one-pass encodes.
        for i in $(seq -s ' ' 1 $((PASSES-1)))
        do
            echo $DIVIDER
            echo -e "$COLOR STARTING: Pass $((i+1)) of $PASSES on $DEST$ECOLOR"
            echo $DIVIDER
    
            $MENCODER \
            -ovc lavc \
            -oac lavc \
            -mc 0 \
            -sws 9 \
            -noskip \
            -vf scale=$SCALE,hqdn3d=2:1:2,pp=ac,harddup \
            -srate $SRATE \
            -af lavcresample=$SRATE,channels=$CHANNELS \
            -channels $CHANNELS \
            -lavdopts threads=$THREADS:fast \
            -lavcopts threads=$THREADS:vpass=3:aspect=$VASPECT:vcodec=mpeg2video:\
    vrc_buf_size=1835:vrc_maxrate=9350:vbitrate=$VIDEO_BITRATE:\
    keyint=18:trell:mbd=2:precmp=3:subcmp=3:cmp=3:\
    dia=-10:predia=-10:preme=1:last_pred=3:cbp:mv0:acodec=ac3_fixed:abitrate=$AUDIO_BITRATE:\
    lmin=1:dc=10:vstrict=0 \
            -of mpeg \
            -mpegopts format=dvd:tsaf:vaspect=$VASPECT:telecine:interleaving2 \
            -ofps $OFPS \
            -o $DEST \
            $SRC
    
            echo $DIVIDER
            echo -e "$COLOR FINISHED: Pass $((i+1)) of $PASSES on $DEST$ECOLOR"
            echo $DIVIDER
        done
    done
    echo $DIVIDER
    echo -e "$COLOR Job finished: $DEST"
    echo $DIVIDER
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!