[MEncoder-users] [SOLVED] Video from JPG Files Problem

Matt Malone m_j_malone at hotmail.com
Wed Nov 29 17:56:28 CET 2006


Hello All,

About a month ago, I posted because I was trying to stitch together JPGs 
captured from an X-Windows display (the rendered output of a scientific 
program) into a video that was playable on any standard Windoze box.   I was 
provided with many suggestions, which I appreciate.  I describe here how I 
solved this problem, and I am explaining it in detail so it is clear and 
repeatable by others.

Keep in mind, the people I will give my product to are complete ludites when 
it comes to computers so if it does not just work, it is broken.

1) I sized my X-window to be 640x480 pixels (write me for the code).

2) My program drew the graphics corresponding to the timestep (note, my 
program's timestep was 0.01 sec).

3) I captured the window as a jpg using import:

    sprintf(wstr,"import -silent -define jpeg:optimize-coding=false -quality 
100 -window inky frames/% 05d.jpg\0",i);
    system(wstr);

"inky" is just the name I gave my window in X-windows. The "-define 
jpeg:optimize-coding=false" was absolutely required because without it 
import was doing something with the encoding tables on the odd frame (groan) 
that ffmpeg and mencoder did not recognize.

4) I moved all of the analysis frames from a Linux box to a Windose box in 
\frames.

5) I took a frame into irfanview (could have used xv on the Linux side), 
cleared it, (to get a blank 640x480 jpg) and put titles in it and saved it 
as 00000.jpg in \fullvideo.

6) I used copy to make 10 title frames 0000[0..9].jpg, one by one

7) At the Windoze 2000 command line, I used:

   copy 0000*.jpg 0001*.jpg
   copy 0000*.jpg 0002*.jpg
   ...
   copy 0000*.jpg 0009*.jpg

To make 1 second worth of titles, then

   copy 000*.jpg 001*.jpg
   etc

to make 2, then 3 then 5 seconds of titles.

8) I then moved over my analysis frames to numerically follow the titles:

   copy ..\frames\000*.jpg 005*.jpg
   copy ..\frames\001*.jpg 006*.jpg
   etc

I also created some blank frames to insert  between bits but that is another 
story.  I now had my video, complete with titles, in a sequence of JPG 
files.

9) I stitched the frames together on Windoze 2000 using ffmpeg:

   ffmpeg.exe -r 100 -an -i %05d.jpg out_100.mpg

This will play with ffplay.exe:

ffplay.exe out_100.mpg

But it will not play properly on anything else mainly because the frame rate 
was too high.

10) To make something that Windoze media player will play or that I can make 
into a VCD, I created a script to copy every 3rd frame into another 
directory "\third" -- a little more C to author that Windoze .bat file.

    ffmpeg.exe -r 30 -an -i  out_30.mpg

This messed up the timebase just a little but by this point I did not care.

11) This will play in Windoze media player when clicked on, and I used it to 
author a VCD that just plays if you stick the VCD in most regular DVD 
players.

I am confident that anyone who can write the analysis program in the first 
place can follow this recipe to make a video.

After pulling my hair out for a while, moreso everytime I hard-crashed my 
Linux box with mencoder trying to make a .mpg file, I decided I did not have 
the hair to spare and I was pushing my luck with the journalling in the ext3 
filesystem.   I abandoned mencoder and its many variations of command lines 
that, even after reading the manual, I could not make produce a Windoze 
"just play the effing thing" file.

Sorry guys, but mencoder and/or its documentation have to be just a little 
clearer for us regular programmer types who just want to use it, not take 
(yet another) degree in it.

If anyone has a thoroughly tested, fool-proof, won't crash my Linux box 
again command line for mencoder, I would be happy to take my frames and try 
it and amend the procedure in this posting.
BTW, on crashing my Linux box, mencoder: 4, all other programs I have 
written or used since 1995 together: 1, hardware failures: 3 -- Slackware 
all the way.

Matt

_________________________________________________________________
Ready for the world's first international mobile film festival celebrating 
the creative potential of today's youth? Check out Mobile Jam Fest for your 
a chance to WIN $10,000! www.mobilejamfest.com




More information about the MEncoder-users mailing list