Knowledgebase: Tips and tricks
Preview generation using tools other than Quicktime
Posted by Andre Kuehnemund on 25 October 2011 14:30

From a customer:

 

"So now I have 2 working script, first for graphic files & the second for video proxy.

 

1. Graphic files:

I think I need describe it more detailed. So for convert graphic files for PresStore thumbnails I use ImageMagick. Becourse I'm mac user I installed it from macports. If you use macports before it is important to update macport it self, then update all outdated (with older versions I have some trouble) but for this moment (1 september 2011) everything looks good. I recommended install imagemagis with this variants "+graphviz +hdri +jbi +jpeg2 +lqr +mpeg +q32 +rsvg +wmf". When ImageMagick installed you should check it with cli. In PresStore I use this extension for ImageMagick dpx, hdr, cin, tif, exr, tga. Now some worlds about script convert command: we need "-quiet" switch be course with out it ImageMagick does not understand photoshop tiff files. "-thumbnail 128x128" - it is our size, enough for me, but may be you need more large thumbnails. 

this is our script

#!/bin/bash

rand=$RANDOM

out=/tmp/pvconv_${rand}.png

/opt/local/bin/convert -quiet "$1" -thumbnail 128x128 "$out"

echo $out

 

At the end I can say that I very happy with ImageMagick. It seems it know every graphic format, works well.

 

 

 

2. Video proxy.

Now I use ffmpeg to convert my files but it is much more complicated job then graphic. The problem is that there are tons of different video codecs, & they grow every day. For example if you have jpeg or tiff file everything clear. But If you have avi - it can contain a lot different codecs inside. So for ideal world I looking for some thing like VLC with command line. VLC seems know every codec & can play it. Again installed ffmpeg form macports, but I installed "ffmpeg-devel".

Lets down to our video script, here it is:

#!/bin/bash

rand=$RANDOM

out=/tmp/pvconv_${rand}.mov

/opt/local/bin/ffmpeg -i "$1" -t 00:00:30 -s 320x180 -aspect 4:3 -loglevel quiet -r 25 "$out" 2>/dev/null

echo "$out"

 

Lets describe some details:

-t 00:00:30 - it is our duration

-s 320x180 -it is size

-aspect 4:3 - with out it ffmpeg can not recognize aspect & does not do the job

-loglevel quiet - may be not necessary, but I use it to minimize I/O 

-r 25 - with out it ffmpeg can not recognize frame rate for some files

2>/dev/null - we need it for a specialty PresStore 

 

I use this extensions in ArchivePlan in PresStore to convert ffmpeg mov, flv, wmv, avi, mpg, m2v, vob.

 

At the end I can say that wile ImageMagick almost ready to use, with ffmpeg you may have some trouble. This is be course a lot of different video codecs. While it is really hard work you should try to check all different variants manually.

 

 

 

 

 

 

Preview generation for movie files.

Just what share my experience with handbrake for preview generation for video files.

I set up & try HandBrake for such porpoise. First thing I would like to say: handbrake only support output mp4 output files. For mac clients it is ok, but for windows users must install quicklime to see any preview. And when i browse archive files it takes more time before browser show me preview.

 

Script:

 

#!/bin/bash

rand=$RANDOM

out=/tmp/pvconv_${rand}.mp4

/bin/HandBrakeCLI -start-at duration:0 --stop-at duration:30 -i "$1" -o "$out" -Y 320 -X 180 2>/dev/null 1>/dev/null

echo "$out"

 

Becource handbrake generate a lot of information when it work I use "2>/dev/null 1>/dev/null" to minimize it. With out it presstore can not catch tail correctly. 

 

At the end I can tell: ffmpeg is faster than handbrake & it can convert movies to mov, it is better.

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).