Hi prupert
How are things - ok here is something that might interest you 
Had already worked out how to show information for mencoder some years back so was now using ffmpeg for libx264 encoding and saw ur post as well. Have used awk aggressively as you will see below in the code and have done away with the need for - among other things 'bc' for floating point stuff and also a simpler direct approach for file information.
this routine is for getting the total frames in a video:
Code:
ffframes ()
{
# same as what you had
ff_length1=( $(ffmpeg -i "$movie" 2>&1 | sed -n "s/.* Duration: \([^,]*\), start: .*/\1/p") )
# here straight awk output of total length
ff_length=( $(echo "$ff_length1" | awk -F':' '{ print $1*3600 + $2*60 + $3 }'));
ff_fps=( $(ffmpeg -i "$movie" 2>&1 | sed -n "s/.*, \(.*\) tbr.*/\1/p") )
# here we have total number of frames
total_frames=( $(echo $ff_length $ff_fps | awk '{ printf( "%3.0f\n" ,($1*$2)) } '));
echo total-frames $total_frames
}
Now the video encoding output
Code:
ffvideo ()
{
ffframes
ffmpeg -i "$fftfile1" $ffmakespecs "$fftfile" 2>&1 | \
awk -vRS="\r" '$1 ~ /frame/ {gsub(/frame=/," ");gsub(/fps=/," ");gsub(/kB/," ");gsub(/time=/," ");gsub(/ \(/," ");print "\n#Converting video : '"$fftfile"'.\\n\\nCurrent Frame :\\t\t"$1"\\t\t\tFrame rate (s) :\\t\t\t"$2"\\nFile size (mb) :\\t\t"int($5/1024)"."int((($5/1024)-(int($5/1024)))*10)"\\nDuration of video :\\t'$ff_length1'\\tTime elapsed in video :\\t"int($6/3600)":"int((($6/3600)-(int($6/3600)))*60)":"int((($6/60)-(int($6/60)))*60)"\\nTime Remaining :\\t"int((('$total_frames'-$1)/$2)/3600)":"int((((('$total_frames'-$1)/$2)/3600)-(int((('$total_frames'-$1)/$2)/3600)))*60)":"int((((('$total_frames'-$1)/$2)/60)-(int((('$total_frames'-$1)/$2)/60)))*60)"\\t\tPercent complete :\\t\t"int(($6/'$ff_length')*100) "%"; \
fflush();}' | \
zenity --progress \
--auto-kill \
--auto-close \
--title="$title" \
--width=500
}
For use in Mencoder encoding :
Code:
/usr/bin/mencoder "$vid_in" "$vid_pass0" "$logo_in" "$tfile" 2>&1 | awk -vRS="\r" '$1 ~ /Pos/ {gsub(/Pos:/," ");gsub(/%\)/," ");gsub(/ \(/," ");print $3"\n#Position :\\t"$1"\\nFrame :\\t"$2"\\nPercentage :\\t"$3"%\\nFrame Rate :\\t"$4"\\nTime Remaining :\\t"$6; fflush();}' | zenity --progress --auto-kill --auto-close --title='${mpg_file_1}' --width=500
Only issue with FFMPEG - so far - is I am unable to get the sliding progress indicator working in the zenity progress dialog.
Hope it helps - let me know what you think of it
cheers
Param
ps.. oh and chiwi that was really funnny ha ha ha
Bookmarks