Finally put together my own batch-preprocessing script for ONYX on Ubuntu - thought I should share it with y'all

15 views
Skip to first unread message

Daniel Caleb Thompson

unread,
Sep 24, 2010, 7:00:47 PM9/24/10
to ony...@googlegroups.com
so, i make videocaptures with gtk-recordMyDesktop and hated all that conversion stuff and then multiple commandline calls and then deleting the pngs and wanted my own filters using imagemagick and finally scrapped this together because I am starting to get booked regularly and just don't have the time for that stuff. i guess that's why we have computers these days - to make our lives simpler.

 thanks to USER at this link: http://ubuntuforums.org/showthread.php?t=806125  for the head start.

i should probably say that you need mencoder, imagemagick if you want to have absolute control over your image quality and preprocessing (updated to the most recent version and don't forget to
export LD_LIBRARY_PATH="/usr/local/lib" ) as well as ffmpeg - but if you can't get that to work, then you probably shouldn't be using onyx on ubuntu anyway... (and be careful, once you uncomment the doublehashes in the delete part, this script will permanently delete all pngs and avis from the folder where you are working!!!!!!)

1.
create the file with an editor. Type:
sudo gedit /usr/bin/ogv2onyx

2. copy this and paste it into the file
#!/bin/bash
# ogv to avi to pngs via imagemagick to swf
# denjell's batchprocess from recordMyDesktop to ONYX flash 9.0 swf
# denjell -> loun...@gmail.com
# Call this with multiple arguments
# for example : ls *.{ogv,OGV} | xargs ogv2avi
N=$#;
echo "Converting $N files !"
for ((i=0; i<=(N-1); i++))
do
echo "converting" $1
filename=${1%.*}
mencoder "$1" -ovc xvid -oac mp3lame -xvidencopts pass=1 -o $filename.avi

#change to pngs cuz pngs are better than jpgs
#this is likely to crash if you don't have enough space on your harddrive
#you could mod the "320x240" if you have a super high performance video card and gigs to spare
ffmpeg -i $filename.avi -an -s 320x240 -y %d.png

#this is where i usually add my watermark or do other post-processing to the images with imagemagick
#just save different versions depending on what you want to do - and delete the doublehashmarks ;)

for PNG in *.png
do

##  echo Watermarking $PNG
##  composite -gravity SouthEast watermark.png $PNG ${PNG//.png}.png

#unsharp mask ( http://www.imagemagick.org/Usage/convolve/#edgedet )
##  echo Unsharpmasking $PNG
##  convert $PNG -set option:convolve:scale '!' -bias 50% -morphology Convolve DoG:0,0,2  $PNG

#color sweetness ( http://www.imagemagick.org/Usage/convolve/#laplacian )
##  Awesome Filtering $PNG
##  convert $PNG -colorspace Gray    -channel G \
##          -set option:convolve:scale '50%!' -bias 50% \
##          \( -clone 0 -morphology Convolve Sobel:0 \) \
##          \( -clone 0 -morphology Convolve Sobel:90 \) \
##          -delete 0 \
##          \( -clone 0,1 -fx '0.5 + atan2(v-0.5,0.5-u)/pi/2' \) \
##          \( -clone 0   -fill white -colorize 100% \) \
##          \( -clone 0,1 -fx 'hypot(u-0.5,v-0.5)*2' \) \
##          -delete 0,1 -separate +channel \
##          -set colorspace HSB -combine -colorspace RGB \
##          ${PNG//.png}.png

done
#change to swf
#is this optimal? seems to work for me...
ffmpeg -f image2 -i %d.png -r 30 -f avm2 -b 10000k -b 500k -ab 256k -y $filename.swf

#permamently delete ALL pngs and all avis
#I left these double-hashed so you don't DDOS me juscuz you copied and pasted without reading the comments
##rm -e *.png
##rm -e *.avi

shift 1
done

3. save the file

4. make the file executable, type:
sudo chmod +x /usr/bin/ogv2onyx

5. call the command with the syntax  after navigating to the respective folder where the originals exist and should be made
ogv2onyx file1.ogv file2.ogv file3.ogv

6. choose about 12 files and go for a walk. you've earned it.


hope this helps someone! just writing this mail helped me tidy up the code (and my system) ...

cheers
--
daniel caleb thompson
artists' house weimar
zeughof 1
http://kuenstlerhaus-weimar.de

"believe in the data, not your fantasies"
-geoffrey hinton

Daniel Caleb Thompson

unread,
Sep 25, 2010, 8:02:48 AM9/25/10
to ony...@googlegroups.com
so, after working with this for a while, i figured out a couple bugs and forgot a citation. here is the revised code:


#!/bin/bash
# ogv to avi to pngs via imagemagick to swf
# denjell's batchprocess from recordMyDesktop to ONYX flash 9.0 swf
# denjell -> loun...@gmail.com

# Call this with multiple arguments
# for example : ls *.{ogv,OGV} | xargs ogv2avi

# thanks to http://gallery.menalto.com/node/14244 for the clue on binding the library
export LD_LIBRARY_PATH="/usr/local/lib"


N=$#;
echo "Converting $N files !"
for ((i=0; i<=(N-1); i++))
do
echo "converting" $1
filename=${1%.*}
mencoder "$1" -ovc xvid -oac mp3lame -xvidencopts pass=1 -o $filename.avi

#change to pngs cuz pngs are better than jpgs
#this is likely to crash if you don't have enough space on your harddrive
#you could mod the "320x240" if you have a super high performance video card and gigs to spare
ffmpeg -i $filename.avi -an -s 320x240 -y %d.png

#this is where i usually add my watermark or do other post-processing to the images with imagemagick
#just save different versions depending on what you want to do - and delete the doublehashmarks ;)

for PNG in *.png
do

#the loop has to something...
echo Not doing anything to $PNG


##  echo Watermarking $PNG
##  composite -gravity SouthEast watermark.png $PNG ${PNG//.png}.png

#unsharp mask ( http://www.imagemagick.org/Usage/convolve/#edgedet )
##  echo Unsharpmasking $PNG
##  convert $PNG -set option:convolve:scale '!' -bias 50% -morphology Convolve DoG:0,0,2  $PNG

#color sweetness ( http://www.imagemagick.org/Usage/convolve/#laplacian )
#THIS FILTER TAKES TIME!!!
##  Awesome Filtering $PNG

##  convert $PNG -colorspace Gray    -channel G \
##          -set option:convolve:scale '50%!' -bias 50% \
##          \( -clone 0 -morphology Convolve Sobel:0 \) \
##          \( -clone 0 -morphology Convolve Sobel:90 \) \
##          -delete 0 \
##          \( -clone 0,1 -fx '0.5 + atan2(v-0.5,0.5-u)/pi/2' \) \
##          \( -clone 0   -fill white -colorize 100% \) \
##          \( -clone 0,1 -fx 'hypot(u-0.5,v-0.5)*2' \) \
##          -delete 0,1 -separate +channel \
##          -set colorspace HSB -combine -colorspace RGB \
##          ${PNG//.png}.png

done

#change to swf
#is this optimal? seems to work for me...
ffmpeg -f image2 -i %d.png -r 30 -f avm2 -b 10000k -ab 256k -y $filename.swf


#permamently delete ALL pngs and all avis
#I left these double-hashed so you don't DDOS me juscuz you copied and pasted without reading the comments
##rm -e *.png
##rm -e *.avi

shift 1
done




daniel caleb thompson
artists' house weimar
zeughof 1
http://kuenstlerhaus-weimar.de

"believe in the data, not your fantasies"
-geoffrey hinton


batchass

unread,
Sep 25, 2010, 8:05:43 AM9/25/10
to Onyx Mailing List
Thanks for sharing, Daniel!

Daniel Caleb Thompson

unread,
Sep 25, 2010, 9:01:39 AM9/25/10
to ony...@googlegroups.com
my pleasure. can't wait for 4.3.1!!!



--
daniel caleb thompson
artists' house weimar
zeughof 1
http://kuenstlerhaus-weimar.de

"believe in the data, not your fantasies"
-geoffrey hinton


On Sat, Sep 25, 2010 at 2:05 PM, batchass <batch...@gmail.com> wrote:
Thanks for sharing, Daniel!

--
You received this message because you are subscribed to the Google Groups "Onyx Mailing List" group.
To post to this group, send email to ony...@googlegroups.com.
To unsubscribe from this group, send email to onyxvj+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/onyxvj?hl=en.


Reply all
Reply to author
Forward
0 new messages