Showing posts with label avi. Show all posts
Showing posts with label avi. Show all posts

Saturday, October 13, 2007

Thumbnails from SWF video

I don't know if this'll ever be useful to anyone, but it was information I needed, and it was extremely hard to come by.

Here's how you extract a thumbnail from an video stored in an swf file. I'll leave the apt-get install dependencies as an exercise to the reader.

#!/bin/bash
SWF="$1"
AVI="${SWF/swf/avi}"
JPG="${SWF/.swf/%d.jpg}"
flasm -x "${SWF}"
mencoder -endpos 5 "${SWF}" -o /dev/null -nosound -ovc xvid -xvidencopts pass=1:turbo

mencoder -endpos 5 "${SWF}" -o "${AVI}" -nosound -ovc xvid -xvidencopts pass=2:bitrate=1600

ffmpeg -i "${AVI}" -an -ss 00:00:03 -t 00:00:01 -r 1 -y -s 120x90 "${JPG}"


BTW, this also converts the SWF to an AVI along the way, so if that's useful to you, great. (Modify the endpos and get rid of -nosound if you really wanted the AVI.)