LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-25-2009, 02:48 PM   #1
handband2
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Rep: Reputation: 0
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!

Code:
#!/bin/bash

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
 
Old 08-26-2009, 10:07 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i think you want to look into zenity or gdialog.
http://linux.die.net/man/1/zenity
the option you need is probably --progress

Last edited by schneidz; 08-26-2009 at 10:08 AM.
 
Old 08-27-2009, 12:37 AM   #3
handband2
LQ Newbie
 
Registered: Nov 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by schneidz View Post
i think you want to look into zenity or gdialog.
http://linux.die.net/man/1/zenity
the option you need is probably --progress
schneidz,

Thanks, I did end up using zenity. This is what the code looks like now:
Code:
#!/bin/bash
## Youtube formating:  http://www.google.com/support/youtube/bin/answer.py?answer=132460&topic=16612&hl=en-US
## Recommended: 1280 x 720 (16x9 HD) and 640 x 480 (4:3 SD)
## http://www.flashsupport.com/books/fvst/files/tools/video_sizes.html
## 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."
exit
fi

# 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
fi

# How many files to make the progress bar
PROGRESS=0
NUMBER_OF_FILES=`find . -maxdepth 1 -type f -name "*.MTS" | wc -l`
let "INCREMENT=100/$NUMBER_OF_FILES"

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"
let "PROGRESS+=$INCREMENT"
done
) | zenity  --progress --width=300 --title "Converting "${NUMBER_OF_FILES}" Files to "${SIZE}"" --percentage=0

Last edited by handband2; 08-27-2009 at 12:41 AM.
 
Old 08-27-2009, 10:05 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
hi, i made this a while back in case you are interested:
http://www.linuxquestions.org/questi...tc.ksh-510861/
__________

also this post #2 has a mencoder based dvd ripper but no nautilus script front-end:
http://www.linuxquestions.org/questi...center-719104/

Last edited by schneidz; 08-27-2009 at 10:08 AM.
 
Old 03-31-2012, 03:22 AM   #5
allankelly
LQ Newbie
 
Registered: Mar 2012
Posts: 1

Rep: Reputation: Disabled
Thumbs up

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

Cheers, al.
 
  


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
show mount in nautilus dk_zero-cool Linux - Desktop 1 03-30-2008 05:37 PM
LXer: Radio Talk Show Blitz Progress Report: The Midnight Rider LXer Syndicated Linux News 0 08-22-2007 03:50 PM
LXer: Radio Talk Show Blitz Progress Report: The Power Hour LXer Syndicated Linux News 0 08-21-2007 07:40 PM
How to show a progress bar on the next line? Chowroc Programming 10 10-26-2005 10:27 PM
How to use mv in console to show progress? Alinuxnoob Linux - General 4 09-15-2004 06:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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