Sync audio and video on a real-time compression from webcam

Hello all, first of all, sorry about my english

Well, im having problems capturing audio and video from a webcam and compressing it to a local file using IV50 and GSM.

I already have merged the source and cloned it so I can compress and show for the user what is beign captured at the same time. The problem is that the video and audio that im showing to user is OK, no Sync problems, but the compressed one is sometimes out of sync, the audio seems to have a delay.

I tryed to do the sync using the clock from the video track and setting it to the audio track, and vice-versa, but i got a Clock exception saying that the clocks are incompatibles. I think that must be a way to do it, since JMStudio just do it fine.

My question is, how can i sync the audio and video using clocks without getting that incompatible clock exception? must i sync the clone's processor or the processor who is encoding the video? why my video is syncronized when i show it in the screen but not when i record it to a file?

`Please help me! and sorry about my english again

Thanks!

[1106 byte] By [javazillaa] at [2007-11-27 11:16:13]
# 1

Well i was making some tests with JMStudio and it seens that even JMStudio have the same issues that my program have.

When i start to capture the video, the sync seens to be OK, but 10 minutes later, the audio is totally out of sync, is this some kind of BUG (Since it occurs in JMStudio also) or im doing something wrong?

Does anyone already seen a JMF implementation that capture local webcam/mic to a local file that works flawless?

Any help will be appreciated, since i already finished the project and the only thing left to do is the audio/video sync..

Tank you for any help!

javazillaa at 2007-7-29 14:17:48 > top of Java-index,Security,Cryptography...
# 2

Noone have this issue?

Can someone with a webcam/mic and JMF 2.1.1e installed record a 10-15 movie and test if the audio is synced with video please?

I found this

http://www.dutchie.net/jmf/bugs/sync.htm

This claims to be a fix to audio and video sync issue, but I tested it and the video stills be out of sync.. does anyone have any idea what class i have to manual implement to fix it? i really need this to be fixed, please someone help me :(

javazillaa at 2007-7-29 14:17:48 > top of Java-index,Security,Cryptography...
# 3

I have not tried this but did take a quick look at that code. I believe that I probably found the change to the rounding, but am less than convinced this would help. The timestamp on the buffers from the capture device may well be 1 and so they have to be derived, and possibly in BasicMux. There is a method there where the video timestamp is set by one approach, using System.currentTimeMillis(), and the audio by another, using mediaTime[trackID]. I might guess that this is where the differences accrue, and you may just have to print out the values there and see if there is anything to learn from that. I am hopeful it has to be a problem with the allocated timestamps. Good luck.

andyblea at 2007-7-29 14:17:48 > top of Java-index,Security,Cryptography...