Re: Re: Video4linux-list digest, Vol 1 #225 - 12 msgs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Ori Pessach wrote:
> 
> Hi,
> 
> Here are the patches against xawtv-3.35. Be aware that this bit of hackery is
> far from perfect: it causes the capture rate to be visibly jerky at times,
> since the video capture thread is trying to sync to a time line that advances
> in rather large steps, and is at the mercy of the system's scheduler. The
> audio time line is just inherently jittery.
> 
> In fact, the more I think about it, the more I'm convinced that a
> multithreaded capture architecture is simply a bad idea, and can't be made to
> work reliably. A two thread design, with a realtime priority thread doing
> video and audio capture, and a low priority thread doing the encoding, should
> work much better. In my opinion, ffmpeg's capture code would be a good
> starting point to get a decent video capture app up and running with minimum
> hacking.
> 
> Anyway, there are two patches - for some reason, the only way I could get the
> source to patch correctly was to use:

If you want a quick-and-dirty synch technique that works very well, try
qtrec (http://www.ee.up.ac.za/~justin/v4l2/).  The current version may
not even compile, but the synch technique works great.  How it works:

1) Calculate exactly how many audio samples there should be per video
frame.
2) Wait for a valid video frame.
3) The moment the frame is complete use GETISPACE on the dsp to
determine how much audio data is available.
4a) If the are fewer samples available than are required per frame, then
read what samples are available, and pad the rest by duplicating the
last value.
4b) If there are more than twice the number of samples required, then
drop one frame worth of audio.
4c) if (!4a || 4b) read one frame's worth of audio data.
5) Write video and audio to output.

(Note that the maximum audio correction at one time is 20ms - which is
barely audible.)

As I said, this is quick-and-dirty, but it works very well.  Last night
I recorded a 1 1/2 hour movie without any noticeable synch problems (and
no noticeable audio defects).  In fact, to test it, I have forcibly set
the dsp rare off by as much as + and - 25% - the audio sounded as though
it was pitch-shifted, but was still pretty good.

-justin





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux