PDA

View Full Version : Better telecine for still digital camera video?


zilog jones
16th September 2004, 00:34
My Sony DSC-P73's video output is quite odd - it's stated as "15 fps", but what it really does is make a 25fps video (MPEG1, 640x480), and has the frames in the order I-I-P, P being identical to the previous frames (is this what P frames are usually like? I'm quite new to this MPEG stuff). As you may guess it's quite jerky and uneven.

Even when I set the camera on NTSC video, it still makes the same 25fps video - it just changes the TV-out to NTSC.

I was wondering, is there some way I could spread those I frames more evenly onto 50fps video and just drop the P frames alltogether using some sort of script, and then weave it? I really wouldn't know were to begin...

(And this has nothing to do with the other MPEG video I was also coincidentally posting about today)

Mug Funky
16th September 2004, 04:43
you could use decimate to remove duplicate frames.

decimate(3) will output 16.67 fps, not 15. however, if you see no dupes in the output, then i suppose the camera's manual was wrong.

as far as weaving goes, you probably wont get any advantage from it.

could you post a sample?

oh, and btw, here's how I, P and B frames in mpeg work:

I frames are intra coded - meaning it is self-contained, and doesn't refer to any other frames (intra vs inter)

P frames are forward predicted (P for Predicted:)). this means they only code the differences from the last P or I frame, either by predicting motion of moving blocks, or by simply using intra blocks where no good motion could be found.

B frames are forward and backward predicted - they are sandwiched between I and P frames, and use information from both frames (not just the last one, but the next) to reconstruct themselves. for this reason they are far smaller than P frames, but tend to incur a higher error in most encoders.

a regular mpeg stream will have a frame sequence (GOP structure) like
IBBPBBPBBP
IBBPBBPBBP
IBBPBP # scene change detected
IBBPBBPBBP

...etc.

what your camera is (probably) doing is only encoding I frames and using a P frame with all blocks set on "skip" mode, so they just show the last frame. most digicams don't have motion-detection chips in them, so they only do I-frames.

zilog jones
17th September 2004, 22:59
Thanks for the MPEG info! There should be a sample at www.skynet.ie/~zilog/sample.mpg (2.2MB). That sample starts off with only one I frame before a P frame because of the way I cut it.

Decimate(3) works OK, but I think there could be something wrong with MPEGdecoder (I just downloaded it off the AVISynth site now) or something as seems to not want to finish the video with whatever I'm playing it through, and to make things worse it stops at different times each time I try. In Virtual Dub it seems to like finishing at frame 122, though the frame it shows can be different depending on how I look through the video, and sometimes some of the frames are scrambled. Even when I don't put Decimate in the script and just load the video with MPEGdecoder it won't process the whole video properly, either. Is there any other MPEG1 plugin for AviSynth?

I'm using AviSynth 2.54, by the way.

On closer examination the manual doesn't actually specify the framrate at all - it just says it's "MPEG1 compliant (Monoural)" (that's Sony being "helpful" fer ya!) - I think it was some review I saw of the camera said it was 15fps.

scharfis_brain
19th September 2004, 09:03
hmm. somewhere @ neuron2.net I discussed that problem, sucessfully using a three step approach:

- decimate(3) the video
I1 I2 P3 I4 I5 P6 becomes I1 I2 I4 I5

- do a motion compensated interpolation with motionperfect (or maybe MVTool, not tested jet)
I1 I2 I4 I5 becomes I1 J1 I2 J2 I4 J4 I5 J5

- then knock out the interpolated frames between the two I-frames using selectevery(...)
I1 J1 I2 J2 I4 J4 I5 J5 becomes I1 I2 J2 I4 I5 J5


I will test it with MV-tools...

scharfis_brain
19th September 2004, 17:20
here a result:

http://home.arcor.de/scharfis_brain/samples/z.avi (2.1MB)

I used the following steps:

-deshake the MPEG video with deshaker
- saved as Huffy-AVI and processed with this script:


loadplugin("D:\x\mvtools.dll")

x=avisource("y.avi") #.showframenumber(scroll=true)
i=x.selectevery(3,0,2)

bwd=i.mvanalyse(isb=true ,lambda=2000)
fwd=i.mvanalyse(isb=false,lambda=2000)
j=i.mvinterpolate(bwd,fwd,bl=0.40,el=0.60,nb=8).subtitle("x") #mark interpolated frame
u=interleave(j,i)
u.selectevery(4,1,2,3)