Discussion:
Reading audio data from an .ogv video
Nuno Moreira
2011-08-17 18:10:08 UTC
Permalink
I need some info on how can I read the audio data from an .ogv video.
I'm creating an in-game player and so far I'm only able to read and render the frames of the video (no audio). Tried splitting the video from the sound but it got out of synch really quickly.
Thanks,
Ralph Giles
2011-08-17 20:48:20 UTC
Permalink
Post by Nuno Moreira
I need some info on how can I read the audio data from an .ogv video.
I'm creating an in-game player and so far I'm only able to read and render
the frames of the video (no audio). Tried splitting the video from the sound
but it got out of synch really quickly.
Sounds like you're reading the audio data correctly, and the problem
is just in your synchronization code. Sound cards generally don't have
very accurate clocks, so you need to schedule video playback based on
the audio playback clock. For example, keep track of how often the
audio engine requests a new playback buffer and update the visible
video frame based on that.

HTH,
-r
Chris Pearce
2011-08-17 22:02:45 UTC
Permalink
Chris Double has a blog post outlining A/V sync in a simple ogg player:
http://www.bluishcoder.co.nz/2009/06/27/playing-ogg-files-with-audio-and-video.html

If you're interested I took his code and added seeking support, and it's
available here:
https://github.com/cpearce/plogg
(There are a few bugs in the seeking code I've not fixed, but it works
most of the time).


Chris Pearce.
Post by Ralph Giles
Post by Nuno Moreira
I need some info on how can I read the audio data from an .ogv video.
I'm creating an in-game player and so far I'm only able to read and render
the frames of the video (no audio). Tried splitting the video from the sound
but it got out of synch really quickly.
Sounds like you're reading the audio data correctly, and the problem
is just in your synchronization code. Sound cards generally don't have
very accurate clocks, so you need to schedule video playback based on
the audio playback clock. For example, keep track of how often the
audio engine requests a new playback buffer and update the visible
video frame based on that.
HTH,
-r
_______________________________________________
theora mailing list
http://lists.xiph.org/mailman/listinfo/theora
Loading...