The thread about interlaced vs progressive video quality contained a lot of useful info about how to deal with progressive and interlaced video. Now I want to try appying it do something useful, I hope. :) Suppose I want to mix progressive and interlaced video material. For example, I have a bit of captured interlaced video and a ppm picture. I want to combine them into a single interlaced MPEG2 stream that looks like this:
1. ppm image, shown for 4 seconds. 2. 10 seconds of captured, interlaced video 3. same ppm image, shown for 4 seconds.
Please let me show you how I would use the MJPEG tools to do this and comment on it.
In order to combine all of this into one MPEG2 stream, I start with converting all three components to MJPEG files. All three MJPEG files need to have the same resolution, interlacing and so on, or else lavtrans won't be able to merge them into a single MJPEG file.
STEP 1:
I use ppmtoy4m to convert the ppm image to a single-frame interlaced MJPEG file:
cat picture.ppm | ppmtoy4m -F 25000:1000 -I t -L | yuv2lav -f a -q 98 -o single_picture.avi
Top field first interlacing is the only option I have, or else all the scanlines in the picture will be interchanged, which looks terrible. The option "-L" seems to be required. Without it, ppmtoy4m says:
INFO: [ppmtoy4m] Command-line Parameters:
INFO: [ppmtoy4m] framerate: 25:1
INFO: [ppmtoy4m] pixel aspect ratio: 1:1
INFO: [ppmtoy4m] interlace: top-field-first (field-sequential PPM input)
INFO: [ppmtoy4m] starting frame: 0
INFO: [ppmtoy4m] # of frames: all, until input exhausted
INFO: [ppmtoy4m] chroma subsampling: 4:2:0, JPEG/MPEG-1, interstitial siting
**ERROR: [ppmtoy4m] Failed to read first frame.
STEP 2:
I use lavtrans to 'grow' a new avi file by adding 'single_picture.avi' to itself and repeat that 100 times, like so (pseudo code):
cp single_picture.avi picture.avi
for i = 0, i < 100, i++ {
lavtrans -o picture.avi -f a picture.avi single_picture.avi
}
Now I have a nice interlaced MJPEG file that shows my picture for 4 seconds.
STEP 3:
Before merging the captured video with the generated picture avi, we need to make sure that the captured avi is top field first as well. If not, we need to change it's field order to match.
When the field order matches, we merge the picture (picture.avi) and the captured video (capture.avi) into one avi file:
lavtrans -o merged.avi -f a picture.avi capture.avi picture.avi
STEP 4:
Finally, we encode the MJPEG file with mpeg2enc:
lav2yuv merged.avi | yuvscaler -O DVD | mpeg2enc -f 8 -b 8500 -q 4 -o merged.m2v
Done!
The most important question would probably be: Can I expect the resulting video to look good on a TV screen? I can't try this at home because I don't own a DVD burner myself, so I ask what you expect based on your experience. I am a bit worried about this, because I lied to the ppmtoy4m program about the ppm image being interlaced, while it's not. The top and bottom fields of the image are very different, especially when the image contains lots of thin horizontal lines. Could this mean that the TV image starts flickering at 50 fps?
Thanks a lot for your time, I appreciate it.
Dik
-------------------------------------------------------
This Newsletter Sponsored by: Macrovision For reliable Linux application installations, use the industry's leading
setup authoring tool, InstallShield X. Learn more and evaluate today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/
_______________________________________________
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users