FPS override audio sync problem

Started by trase, October 24, 2012, 09:00:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

trase

I was hesitating where to place this, since I don't know if is a bug in magic lantern or if the problem lies elsewhere.

I have been trying to record 720p at 30fps with sound record enabled (WAV).
Using Avidemux I change the video to 30fps and add the audio track. However, after less than 30 seconds the tracks are already noticeably out of sync.
I can only get them to sync decently by changing the framerate to somewhere about 30.6 fps.

Anyone else encountered this problem?
Does magic lantern not really record at exactly 29.97 fps as it states, or is it something else that causes this?

1%

Yea. Are you getting skips? It seems like it speeds up/slows down to me.

trase

There are no skips or soundglitches in the recorded material as far as I can tell. (Don't know if there's a way to check that more scientifically).
And no skips during playback of the re-encoded video.

nanomad

Then the FPS computation isn't really accurate (IIRC we are approximating the base frequency used for FPS calculation)
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

1%

For me the lengths of the wavs don't match the video even at stock fps.

trase

I did some more testing now -
Filming a clock, I came to the conclusion that ML does indeed achieve the correct frame rate. The video is running at the right speed.

It is the audio that is somehow running too fast. About one second per minute.
(Well, either it's running too fast or there are microskips that causes it to end up being too short)

(this thread should perhaps be moved to bug reports)

1%

I've tried fixing it, its more pronounced on stereo and at higher data rates. Need to write out the buffer in a more exacting manner. I feel there is delay or duplication between the 2 buffers, one is reading, one is writing. I've also tried adding sync marks/beeps and they do not fall at exact distances. They drift apart even when the first beep hits in exactly the same spot.

In stock ML it was more difficult to notice because the wav is mono and read as uint8. 16bit and 32bit buffers it gets very pronounced. 32bit sounded great (and "full") when not skipping but interfered with recording.

See:
http://www.magiclantern.fm/forum/index.php?topic=3001.0

trase

Good to hear that you are aware of the issue and that you have already tried several ways to fix it.
(I hadn't seen the other thread so I didn't know that you were already on it).

I'm not a developer and haven't really got a clue, but yes, it sounds like the separate wav function is taking up too much processing power, and that is what is causing the dropouts (which in turn leads to the out of sync issue). So yes, perhaps a more efficient buffer handling could make it work better, I guess the circular buffer technique could be worth trying if that's not too much of a hassle.
Have you tried 22kHz or even 11 just to see if that makes a difference?
Or could the dropouts be caused by disturbance of other processes, I mean, like some other process suddenly gets higher priority and steals the cycles. You don't have to answer, just thinking out loud here.

1%

Or timing between movie recorder and the task writing the wav. I haven't tried 22 but I did 44.1 and t didn't help so I didn't try lower ones.