The result is the possibilty to create a mpeg stream (video only) from jpeg pictures stored in a given directory. Furthermore all these picture do NOT need to have the same size. So if you just bought yourself a X Megapixel camera but are still stuck with tons of low resolution jpegs you can all put then in your slide show without have to first resize them etc...
The first change is that of changing the meaning of the -j option of jpeg2yuv. Instead of specifiying the input file(s) it now specifies the input directory.
The second change is the addition of a -l option to the yuvscaler. This specifies how many times every image has to be duplicated in the output stream. Adding this option to the yuvscaler saves a lot of work (convert to YUV and rescale once, duplicate a lot). Note that the value of the -l option depends on your framerate!
./jpeg2yuvstills -f 25 -I p -n 1 -j Images/ | ./yuvscalerstills -O SVCD -l 250 | mpeg2enc -f 4 -o svcd.m2v
For the other parameters look on the sourceforge homepage of the mjpegtools or in the manpages.
If you wish to recompile for you own architecture. Copy the file bollow in the appropriate subdirs of the mjpegtools-1.6.2 directory. Better backup the originals somewhere. NOTE: the yuvscaler and jpeg2yuv utils will be replaced by the patched version! This because I did NOT change the Makefile and other configuration files. Neither did I add any indication at the beginning of the source files.
What happened with the original tools (well at least that's how I understood it by looking at the code). The jpeg2yuv generates a stream which is fed into the yuvscaler. The yuvscaler then does its work before passing it to the next tool the mpeg encoder mostly (mpeg2enc). The streams produced by jpeg2yuv or yuvscaler looks like this:
SH = stream header FH = frame header [SH [FH YUV YUV .... YUV] [FH YUV YUV ... YUV] ... [ FH YUV YUV ... YUV]]
This works very well because the original tools expect images coming from 1 and the same source (ie. a digital camera). So all the input images are supposed to have the same size. This was rather inconvenient. Therefore I modified the stream generated by the jpeg2yuv a little. And of course had to modify the yuvscaler to handle the new stream structure.
Following the Keep It Simple Stupid principle I kept the changes to a minimum. The new stream structure is actually nothing but a concatenation of the original stream structure (simple enough ;) ). In other words the jpeg2yuvstills can produce stream looking like this (for example):
[SH [FH YUV YUV .... YUV] ... [FH YUV YUV ... YUV]] [SH [FH YUV YUV ... YUV] ... [FH YUV YUV ... YUV]]
For my slide show purpose each image is process only once by jpeg2yuvscaler. So the output stream consist of several streams with each stream containing only one frame. For a directory containing 3 pictures this would give:
[SH [FH YUV YUV .... YUV]] [SH [FH YUV YUV ... YUV]] [SH [FH YUV YUV ... YUV]]
This stream contains enough information for the yuvscalerstills to do its work for each frame, even if the frame have different sizes. The yuvscaler still produces a valid stream (ie. with 1 stream header) and thus can readily feed it output to the other tools.