-   Programming (
-   -   Show Progress with Nautilus script (

handband2 08-25-2009 02:48 PM

Show Progress with Nautilus script
I have a script which I run to convert my .MTS videos to .flv. The script is in my Nautilus script folder. When I run the script it runs perfectly fine in the background without showing me any progress. I would like to see the progress of the conversions.

I've tried to get gnome-terminal and xterm pop-up to show the progress without success. I would appreciate it if someone could help, thanks!



mkdir ./converted

for f in *.MTS; do ffmpeg -i "$f" -vcodec libx264 -acodec libmp3lame -ar 22050 -ab 32K -s 768x432 -f flv ./converted/"${f%.mpg}.flv"; done

schneidz 08-26-2009 10:07 AM

i think you want to look into zenity or gdialog.
the option you need is probably --progress

handband2 08-27-2009 12:37 AM


Originally Posted by schneidz (Post 3658363)
i think you want to look into zenity or gdialog.
the option you need is probably --progress


Thanks, I did end up using zenity. This is what the code looks like now:

## Youtube formating:
## Recommended: 1280 x 720 (16x9 HD) and 640 x 480 (4:3 SD)
## Widescreen: 256x144  - 512x288 - 768x432 - 1024x576

#Check for required software...
ffmpeg_bin=`which ffmpeg | grep -c "ffmpeg"`

# Check for ffmpeg
if [ $ffmpeg_bin -eq "0" ]; then
zenity --error --title="Error - Missing Software" \
 --text="You do not have the ffmpeg package installed
Please install it in order to use this script.
Make sure that the Universe repositories are enabled and
then type: 'sudo apt-get install ffmpeg' at a terminal."

# Dialog box
SIZE=`zenity --height=220 --width=220 --list --radiolist \
        --title="Choose Resolution" \
        --column="Check" --column="Size" \
        "" "256x144" \
        "" "512x288" \
        "" "768x432" \
        "" "1024x576" \
        "" "1280x720"`

if [ "${SIZE}" == "" ]; then   
zenity --error --text="Resolution not defined by user.
Please choose a resolution to use. "
exit 1

# How many files to make the progress bar
NUMBER_OF_FILES=`find . -maxdepth 1 -type f -name "*.MTS" | wc -l`

mkdir ./converted

# Converting Files
(for file in *.MTS; do
echo "$PROGRESS";
echo "# Converting $file ...";
ffmpeg -i "$f" -r 29.97 -vcodec libx264 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s "${SIZE}" -aspect 16:9 -acodec libfaac -ab 112kb -ar 48000 -ac 2 ./converted/"${file%.MTS}.mp4"
) | zenity  --progress --width=300 --title "Converting "${NUMBER_OF_FILES}" Files to "${SIZE}"" --percentage=0

schneidz 08-27-2009 10:05 AM

hi, i made this a while back in case you are interested:

also this post #2 has a mencoder based dvd ripper but no nautilus script front-end:

allankelly 03-31-2012 03:22 AM

Thanks for the zenity tip. I just want to see the output of my script so I pipe into zenity --text-info

Cheers, al.

All times are GMT -5. The time now is 07:32 AM.