Keeping audio & video in sync when generating an AVI

category: code [glöplog]
I added AVI capture to Oricutron, and basically i just dump the video and audio frames as they are generated to the output file. After a while the audio goes out of sync from the video. How do you keep them in sync?

The (very basic) implementation is here:


BTW, I didn't just use a library because the whole of Oricutron is a programming exercise for me and I wrote it all from scratch.
added on the 2012-01-07 23:33:47 by xeron xeron
I'd make sure your audio chunk size matches the frame rate. Check your audio lenght. Maybe try supplying a buffer size... Hope that helps.
added on the 2012-01-08 00:32:37 by raer raer