log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- Accessing old floppy disks (Gen:3)
- November developer 'fireside' chat on saturday night (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
Acorn Arcade forums: Programming: Thumbnails: auto-convert AVI to animated GIF [animations]
 
  Thumbnails: auto-convert AVI to animated GIF [animations]
  rich (17:10 8/6/2007)
 
Richard Goodwin Message #102779, posted by rich at 17:10, 8/6/2007
Rich
Dictator for life
Posts: 6828
With my photo albums, I sometimes want to include movie files (because most digital cameras these days have that capability). However, the choice is usually to have a placeholder generic "movie file" thumbnail, or take a screenshot manually and have the album software thumbnail the screenshot then lump all files with the same name but different extensions together. The latter usually means there's two unnecessary image files listed (small and medium, assuming a 640x480 screenshot), and some movie files tacked on at the end. And the screenshot is not always representative of the whole file.

I've finally worked out the magic foo to generate movie thumbnails on the fly from the Linux command line:
mplayer SH107625.AVI -vo gif89a:output=file.gif:fps=1 -vf scale=160:120 -frames 999
This will output a 1 frame per second, 8 frame, 160x120 animated GIF of the movie file. Most of the commands are fairly obvious, but it's the "-frames 999" that limits the eventual GIF to 8 frames; depending on the source movie, YMMV.

As usual, this is here partly to aid others looking to do the same thing; partly so I don't forget it as soon as it falls out of my bash history; and partly so someone can come along and say, "don't do it like that - here's a much better way..."

Edit: adding -saturation -100 outputs a greyscale version.

Edit 2: A different file, from the same camera, gave more frames (29 instead of 8); switching down to -frames -200 gave an 8-frame output, but that means more work needs to be done to investigate the optimum settings.
mplayer SH107674.AVI -vo gif89a:output=SH107674.gif:fps=1 -vf scale=160:120 -frames 200 -really-quiet && chown rich: *.gif

Edit 3: ignore the number of frames; use -endpos 8 to run for only 8 seconds.

Edit 4: You can crop the middle out of a movie, but can't apparently also scale it at the same time.
So, assuming a 640x480 movie: I want just the middle, and as it appears mplayer likes chunks of 16 I'll crop 160 from both sides and 128 top and bottom, leaving a 320x224 central image. Then pass it through (ImageMagick) convert to scale it down; and as I'm doing it using a temporary file, delete that.
mplayer SH107152.AVI -vo gif89a:fps=1.0:output=tmp.gif -vf crop=320:224:160:128 -endpos 15 -really-quiet && convert -scale 50% tmp.gif SH107152.gif && chown rich: *.gif && rm tmp.gif -rf

Also, brightening up a dark movie:
mplayer SH106556.AVI -vo gif89a:fps=1.0:output=SH106556.gif -vf scale=160:120 -saturation -100 -brightness 5 -contrast 100 -endpos 15 -really-quiet

Using all the techniques, get the fox looking as good as possible...
mplayer SH107152.AVI -vo gif89a:fps=1.0:output=tmp.gif -vf crop=352:224:160:128 -saturation +50 -contrast +10 -endpos 15 -really-quiet && convert -scale 50% tmp.gif SH107152.gif && chown rich: *.gif && rm tmp.gif -rf
________
RichGCheers,
Rich.
file.gif 160x120 177.1KB
file.gif
160x120
177.1KB
greyscale.gif 160x120 177.1KB
greyscale.gif
160x120
177.1KB
SH107152.gif 160x120 331.3KB
SH107152.gif
160x120
331.3KB
SH107152-3.gif 176x112 187.7KB
SH107152-3.gif
176x112
187.7KB

  ^[ Log in to reply ]
 

Acorn Arcade forums: Programming: Thumbnails: auto-convert AVI to animated GIF [animations]