views:

398

answers:

2

How do I make image slideshows as a video file via 4 small jpegs (128px x 128px) and Linux command-line graphic tools? I need to vary the slideshow transitions with:

  • fade to/from black
  • slide left/right while fading to next image

If you're curious, we plan to make videos we can put into mobile phones for real estate listings. (We already have the technology to convert Ogg Theora into proprietary mobile formats.)

A: 

Hmm, I was just reading about making linux video DVD's earlier today. Here is a list of linux video editing SW:

http://www.yolinux.com/TUTORIALS/LinuxTutorialVideo.html#VIDEOEDIT

DigitalRoss
A: 

Transitions are just basic image manipulation. Try playing around with ImageMagick.

Converting jpeg to video is easy. The Mplayer software includes mencoder. Then it's just a matter of determining your options and video output type.

Caveat: Sometimes, when going from JPEG -> mpeg2video (for dvds), I find it necessary to transition through mpeg4.

E.g.: JPEG -> mpeg4 -> mpeg2video

So, to take one still JPEG and turn it into $SOUNDLENGTH seconds of video:

mencoder mf://${JPEGFILE}  -mf w=720:h=480:fps=1/${SOUNDLENGTH}:type=jpeg -audiofile ${SOUNDFILE} -ovc lavc -oac lavc -lavcopts vcodec=mpeg4 -ofps 30000/1001 -o ${MPG_1}

mencoder -ovc lavc -oac lavc -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=${VBITRATE}:keyint=18:acodec=ac3:abitrate=192:aspect=4/3:trell:mbd=2:dia=4:cmp=3:precmp=3:ildctcmp=3:subcmp=3:mbcmp=3:cbp:mv0:dc=10 -of mpeg -mpegopts format=dvd -vf expand=720:480,harddup -srate 48000 -af lavcresample=48000 -ofps 30000/1001 -o ${MPG_2} ${MPG_1}
  • $VBITRATE is typically 5000, though it can be lower.
  • harddup solves certain video/audio sync issues with some dvd-players.
  • This presumes a 4/3 aspect ratio. Change it if yer 9x16... (More of an issue for dvd-playback.)
  • If the video images were not the correct size, expand= would give us a black border wasting valuable bits. You may prefer scale= instead of expand=, combining the two, perhaps even adding a crop= term, or AVOIDING IT ALTOGETHER depending on your ultimate video output. In my case, I'm often going from 640x480 to 720x480 (dvd-standard-resolution), with a need to playback on standard (non-computer) hardware. Thus the expand= clause is usually in there by default, along with the black bars and the wasted bits. Though in this case, it should be doing nothing as my original JPEG image was 720x480.
  • This is merely *a* means of JPEG->MPEG conversion. It's not optimized for speed or, really, anything...

If you actually want to build DVDs, the tool to look into is dvdauthor. But it doesn't sound like you need that...

Oh, and you might be VASTLY better served via an animated gif... (Which ImageMagick can create for you.) Animated gifs would be much smaller, and easier to send over limited bandwidth...

Mr.Ree
The problem with animated GIF is that on deployment the browsers are doing the lousy thing of showing every frame slowly at first, and then playing at normal speed once fully downloaded. It would be better to show the initial frame at first, download in the background, and play additional frames once downloaded. But some don't do that.The other problem is that we're deploying to mobile phone, which can support video (only in particular formats), but sometimes not animated GIFs.
Volomike
I like this answer best so far. It appears that if I can go with MP4, then I could use purely ImageMagick and a transitions script (http://www.fmwconcepts.com/imagemagick/transitions/index.php) to convert to what I need.
Volomike