VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. Man of Steel freebird73717's Avatar
    Join Date
    Dec 2003
    Location
    Smallville, USA
    Search PM
    I have just learned about the wonderful ability to add functionality to your nautilus file browser buy using scripts. I thought it would be fun to share the useful scripts I've found and I hope you will share yours too!
    Just copy these text files to your .gnome2/nautilus-scripts directory and make them executable. Then when using nautilus if you right click you will see your scripts in dropdown menu!

    Copy to directoy
    Code:
    #! /bin/bash
    location=`zenity --file-selection --directory --title="Select a directory"`
    for arg
    do
    if [ -e "$location"/"$arg" ];then
       zenity --question --title="Conflict While Copying" --text="File ""$location"/"$arg"" already exists. Would you like to replace it?"
       case "$?" in
          1  )  exit 1 ;;
          0  )  cp "$arg" "$location" ;;
       esac
    else
       cp "$arg" "$location"
    fi
    done
       zenity --info --text "Finished Copying Files"
    move to directory
    Code:
    #! /bin/bash
    location=`zenity --file-selection --directory --title="Select a directory"`
    for arg
    do
    if [ -e "$location"/"$arg" ];then
       zenity --question --title="Conflict While Moving" --text="File ""$location"/"$arg"" already exists. Would you like to replace it?"
       case "$?" in
          1  )  exit 1 ;;
          0  )  mv "$arg" "$location" ;;
       esac
    else
       mv "$arg" "$location"
    fi
    done
       zenity --info --text "Finished Moving Files"
    open terminal to your open directory
    easier than starting terminal then changing to the directory you want
    Code:
    #!/bin/sh
    
    /usr/bin/gnome-terminal
    create an iso image - thanks to disturbed1
    Make sure there are no spaces in the directory.
    #!/bin/bash
    #Makes a DVD UDF(1.02) ISO
    #from the selected folders

    xterm -bg white -fg black +hold -T "Building $1.iso" -e mkisofs -V "$1" -o "/media/path/to/output/iso/$1.iso" -dvd-video "$1" && zenity --info --text="Finished building $1.iso"
    burn iso - thanks to disturbed1
    Code:
    #!/bin/bash
    #Burn iso @ 16 speed
    #large buffer
    
    xterm -bg white -fg black +hold -T "Burning $1" -e cdrecord speed=16 fs=128m -v -eject "$1" && zenity --info --text="Finished Burning $1"

    Batch Encode AC3 from Avi using FFmpeg to get the wav and Aften to encode the AC3
    Just right click anywhere in your directory containing avi files and select this script to batch encode AC3 audio.
    Code:
    #! /bin/bash
    
    for i in *.avi
    do
            BASEFILENAME=$(basename "$i")
    
            ffmpeg -i "$i" -ar 48000 "$BASEFILENAME.wav" && \
            aften "$BASEFILENAME.wav" -acmod 2 -readtoeof 1 -b 192 "$BASEFILENAME.ac3" && \
            rm "$BASEFILENAME.wav"
    done
    
    zenity --info --text="Finished Encoding AC3 Files"



    I am still woking on a full rewrite of HCbatchGUI to be a completely linux based app but in the meantime I have thrown together a nautilus script that can be used to batch encode video and audio using HCenc for video and native linux ffmpeg and aften for audio.
    #! /bin/bash

    ################################################## #############################
    #
    #
    #
    # AUTHOR: freebird73717
    #
    # DESCRIPTION: This script encodes avs video files with HCenc and avi audio files
    # with FFmpeg and Aften.
    #
    # REQUIREMENTS: Nautilus file manager
    # feh (see http://www.linuxbrit.co.uk)
    # zenity/gdialog, which is usually included in the gnome-utils package
    # FFmpeg
    # Aften
    # HCenc
    #
    # INSTALLATION: GNOME 1.4.x: copy this script to the ~/Nautilus/scripts directory
    # GNOME 2.x: copy to the ~/.gnome2/nautilus-scripts directory
    # Copy your HCenc ini-template files to any directory other than a wine directory.
    # Zenity can't read into the wine directory.
    #
    # USAGE: Make sure your avs and avi files are in the same directory.
    # Right click in your video files directory, go to Scripts, and then select this script.
    # You will then be asked to select an Output Directory for your video and audio files.
    # Next you will be asked to select your HCenc ini-template file.
    # Then you will enter the Average Video Bitrate and AC3 Audio bitrate.
    # HCenc will then encode your avs files and ffmpeg and aften will encode your avi to ac3 audio.
    #
    #
    #
    # WHAT WORKS: Everything but the cancel buttons
    #
    # WHAT DOSENT
    # WORK : The aforementioned cancel buttons
    #
    # VERSION INFO:
    # 0.1 (20080311) - Initial public release
    #
    #
    #
    # LICENSE: GNU GPL
    #
    ################################################## #############################

    location=$(zenity --file-selection --directory --title="Select Audio & Video Output Directory")

    HCini=$(zenity --file-selection --title="Select HCenc ini-template file")

    BITRATE=$(zenity --title="Video AVG Bitrate" --entry)

    AUDIOBITRATE=$(zenity --title="Audio Bitrate" --entry)

    for i in *.avs
    do
    BASEFILENAME=$(basename "$i")
    "/home/yourusername/.wine/drive_c/Program Files/HCbatchGUI/HCenc_022.exe" -i "$i" -o "$location/$BASEFILENAME.m2v" -b $BITRATE -maxbitrate 8500 -ini "$HCini"
    done
    for j in *.avi
    do

    ffmpeg -i "$j" -ar 48000 "$j.wav" && \
    aften "$j.wav" -acmod 2 -readtoeof 1 -b $AUDIOBITRATE "$location/$j.ac3" && \
    rm "$j.wav"
    done
    zenity --info --text="Finished Encoding Video & Audio Files With HCenc and Aften!"
    Make sure to change the text in bold blue to the path of your HCenc executable. Also make sure to copy your HCenc ini/template files from your wine directory to some other directory because zenity can't look into the wine directory.

    The maxbitrate for the video is set to 8500 but you can change that by changing the scripts text.
    Hopfully this will help some until I get the rewrite of the gui done (which will probably take some time.)





    I know there are hundreds more that can be used with nautilus these are just the few I am now using. If you have others you find useful please post them here!
    Donadagohvi (Cherokee for "Until we meet again")
    Quote Quote  
  2. Man of Steel freebird73717's Avatar
    Join Date
    Dec 2003
    Location
    Smallville, USA
    Search PM
    I have edited the "copy to" and "move to" scripts to pop up a confirmation dialog letting you know that it finished copying or moving the files.
    Donadagohvi (Cherokee for "Until we meet again")
    Quote Quote  
  3. Get Slack disturbed1's Avatar
    Join Date
    Apr 2001
    Location
    init 4
    Search Comp PM
    Well, you already posted my 2 favs

    Here's another one I use. Since Muxman doesn't create AUDIO_TS/VIDEO_TS directories, and I have a few players that will not play a disc without the VIDEO_TS.VOB/VTS_01_0.VOB files. This creates those files/folders.

    Code:
    #!/bin/bash
    mkdir AUDIO_TS VIDEO_TS &&  dd if=/dev/zero of=VIDEO_TS.VOB bs=10000 count=1 && cp VIDEO_TS.VOB VTS_01_0.VOB  && mv *.* VIDEO_TS
    Then I run IFOEdit, get VTS-Sectors to correct for the new files. Right-Click choose the script mkiso, Right-click choose the script burniso.

    I do a bit of karaoke. This script requires the small program cdg2video. It takes a .cdg file and .mp3 file encodes them to DVD compliant mpeg2 and ac3 streams ready for DVD authoring. Fits around 100 or so karaoke tracks on a single DVD. Problem is, cdg2video creates improper NTSC DVD compliant files by itself (uses mp2 audio) plus DVD Styler works better with elementary streams. This takes care of all of that.

    Code:
    #!/bin/bash
    #Convert mp3+cdg files to
    #DVD compliant m2v and ac3 streams
    
    for i in *.cdg; do cdg2video -f dvd -s dvd-ntsc -r ntsc --force-encode-audio "$i" | zenity --progress --title "CDG2VIDEO" --text "Converting $i to DVD" --pulsate --auto-close;done && for i in *.mp3;do lame --decode "$i" | zenity --progress --title "LAME" --text "DECODING $i" --pulsate --auto-close; done && for i in *.wav;do ffmpeg -i "$i" -ab 192K -ar 48000 "$i".ac3 | zenity --progress --title "FFMPEG" --text "ENCODING $i TO AC3" --pulsate --auto-close; done && for i in *.dvd; do mpgtx -d -b "$i" "$i" | zenity --progress --title "MPGTX" --text "DEMULTIPLEXING $i" --pulsate --auto-close; done && rm *.wav *.mp3 *.cdg *.dvd *.mp2
    The above started as a nautilus script, but I just copied it to /usr/bin and run it from the command line now instead.

    Nautilus scripts are extremely functional. Makes GNOME the most useful DE around (IMO of course).
    Linux _is_ user-friendly. It is not ignorant-friendly and idiot-friendly.
    Quote Quote  



Similar Threads

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