Tovid Wiki
Line 51: Line 51:
 
to produce half-speed Progressive video, without any temporary image files.
 
to produce half-speed Progressive video, without any temporary image files.
   
The C code is here: [http://pastebin.ca/429598|http://pastebin.ca/429598] and it is used like:
+
The C code is here [http://pastebin.ca/429598] and it is used like:
   
 
playdv input.dv --dump-frames - |./slomo | encodedv - > out.dv
 
playdv input.dv --dump-frames - |./slomo | encodedv - > out.dv

Revision as of 09:48, 8 April 2007

Here is a way to convert the fields in 29.97 fps progressive NTSC dv to play at half speed, by playing each field as if it were a whole single progressive frame.

I found that the picture apeared to jitter up and down every original field, which makes sense. Since kino, when exporting single fields, vertically stretches them to be 480 high. So I then used a script and ImageMagick to shift the image up one pixel on half of the new frames. This seems to remove the vast majority of the vertical jitter, but it may not work for all cameras.

So here's how I did it. Note that there are probably better ways. (I just copied these from my personal notes -- feel free to clean up and remove this comment.)

To do half-speed slowmotion:

Notes: Do not resample pixel ratio. Doing so converts from 720 to 640 pixels wide. In Kino: Create a folder called temp. Store all the temp jpegs and jpgs there.

First export all the LOWER fields as temp.jpeg (Notice the jpeg vs jpg, as is next) then export all the upper fields as temp.jpg (DV is lower field first.. e is before g.)

By naming the lower fields *.jpeg and the upper *.jpg, they are numbered by kino sequentally individually and paired up -- thus frame one's two fields become temp0.jpeg and temp0.jpg, and when they are listed with ls, they will be besides eachother.

Then scoot all the *.jpeg files down one pixel.

ls temp/temp_0*.jpeg|while read instr; do composite -geometry 720x480+0+1 $instr $instr $instr; done

The above line shifts the image in all the lower fields down one pixel.

Then CD to the temp dir and interleave them:

c=0;ls|while read instr; do mv $instr $c.jpg; c=`expr $c + 1`; done

The above line renames all the files, in order, to n.jpg where n is a number starting at 0 and counting up for every field.

Then reimport the new jpgs into kino via the FX->Create->Create From File-> option. Note that some versions of Kino are broken, and you cannot type into the filename box, so you have to browse to the 0.jpg, then edit filename box by first typing %d after the zero that's shown, then by deleting the zero.

Of course now that you have all the fields in order as frames, you could use any program you like to convert them to video -- ImageMagick, mplayer, and many others I'm sure.

Sorry this isn't nice and tidy. Feel free to fix, including deleting this line. -Jesse

Oh, -- The sound is, of course, lost. I exported the wave file in Kino then used sox to slow it down, then reimported it (dubbed it back in) to kino.

Also, I think there may be a way to use other commandline tools like playdv and encodedv and different options of IM (ImageMagick) to do the same thing without Kino, but I haven't figured out how yet.



Update

After noting the above method of using ImageMagic and Kino and bash scripts, I threw together a small C program that can be used with pipes between playdv and encodedv to produce half-speed Progressive video, without any temporary image files.

The C code is here [1] and it is used like:

playdv input.dv --dump-frames - |./slomo | encodedv - > out.dv