Monday, November 30, 2009

How to make VirtualDub to append videos encoded at different frame rates?


It's very annoying, isn't it?

In my case, I had 15 fps video, recorded when I had tiny 1GB memory card. Up to now when I found the solution, it was impossible to append them with video shot at 30 fps (All with my sweet Canon Powershot A540, mjpeg 640x480x30fps at about 15 Mbit/s).

VirtualDub of course can convert the framerate to 30 or whatevever. This is the first step:

Video -> Framerate


Also, in order to append to the native AVI, you should use the same compression scheme like in the file you want to append to. In my case - MJPEG.

It's a bit hard to find - MJPEG is in ffdshow section. I suggest you to use high setting to the JPEG like 90 or more to minimize quality losses. (Lossless jpg is best, but different compression.)

Video -> Compression




However, this is still not enough...

When you try to append the resulted 30 fps to a "native" 30 fps produced by the camera, a non-sense error message appears.


It's a rounding error, actually both values are equal to 30.


Solution

Actually, these numbers are values in the AVI headers of the files.
Find the position of these numbers in the files and make them equal.


For Canon A540 and probably the other Powershots it is best to set the values to the "native" values. For other cameras the exact values are probably different.


I located the position there::

0x80: 35 82 00 00

0x84: 40 42 0F 00



You can use a hexeditor, e.g.: XVI32



If you're not a hacker, look on the down-left, this is the position in hexadecimal (80 == 128 in decimal). Put on that places the "magic numbers" (for Canon A540).

And now edit your 15 fps records with the 30 fps ones! :)

PS. Of course it could/should be automated, the easiest way by telling Avery to fix it... ;)


Other keywords: Tricks, Hacks, Solutions, Tricky, Videos running at different framerates, append videos, concatenate videos

No comments :