I’ve a working prototype of an audio player which is able to play MP3 on a specific set of speaker (ex : 1,2,5,8). It plays multiple MP3 on different sets of speackers. I’ve uses FMod and it works very well.
But now, i’me asked to add AVI video. I need to redirect th audio stream to as specific set of speackers.
I’ve seen that Fmod doesn’t support video streams, but I’ve also seen an exemple that do it.
[b:2l7plzao]I’m not too proficient with this subject and I would like some help.[/b:2l7plzao]
I’m woking with VB.Net 2.0
thx for any help you can provide.
- NazguL asked 12 years ago
Yes I’m trying to use the old VFW API (I’ve found one for vb.Net and I’m trying to adapt it to my need.
I’ll ask some more specific questions if I’m stuck.
Thx for the help, btw.
In all case, we’ll choose the codec (audio and video). What codecs do you suggests for vfw compatibility ? Do you think Xvid and MP3 will do the trick ?
- NazguL answered 12 years ago
sorry if my questions are quite noob ones, but I’m trying to solve this for a few days and don’t come close to a solution yet ><.
Like NazguL I’m trying to implement a video player (C++). I found a pretty nice example along with ogg theora lib. I had a few changes to make, in order to have it running on Visual C++ (since the aim is to implement it in a bigger piece of software, must use VC++). Video is ok, sound is decoded by vorbis, and I managed somehow to fill an fmod buffer stream with it. It plays ok too.
Problem is : A/V sync !
In order to do this, I think (not sure though, didn’t fully understand the code and infos I found on the net), I have to fill a video buffer with a full frame, same for audio, and when the two of them are ready launch the playing of the frame, right?
Secondly, for the sound, I’m using a fmod stream (with flag openuser), which I filled with raw sound data decoded via vorbis. I’m not sure it’s the good way to do this, since I don’t have any control on the audio stream, do I? Moreover, something I don’t really understand with this callback is if we don’t have enough or any data to fill the fmod stream buffer with, what is happening? Should I make the callback return a flag that says so (didn’t find which one though )
 another question: When we write data to the buffer returned by the pcmreadcallback, how long will it be before this data is actually read/played by fmod? I think I may have to know this ‘latency’ to align sound & video no?[end edit]
Sorry for being so long and not so clear 😉
If anybody have (simple for my poor mind :p) code source, or info, I will be very pleased to have a look at it.
Thanks a lot
when you actually -play- the sound, it should be on the first frame of the video, so the size of fmods buffer shouldn’t be relevant, as the playback is instantaneous. The real latency would be in the software mixer if you are using FMOD_SOFTWARE. You can get info on that latency using System::getDSPBufferSize (ie the size of the mix buffer), or skip that by using FMOD_HARDWARE. There is always latency in audio though so if you use that you’ll have to specify a fixed delay depending on windows latency, it probably wouldnt be much, something like 5-10ms which isn’t even a video frame.
[quote="brett":115wnjvq]when you actually -play- the sound, it should be on the first frame of the video, so the size of fmods buffer shouldn’t be relevant, as the playback is instantaneous.[/quote:115wnjvq]
Actually, it is FMOD_HARDWARE. That’s why I’m wondering if I’m using the good functions, or in the good way… I have been doing another test : I let a few seconds passed so I have enough sound data for fmod stream. I already created my fmod stream ( createSound with 2D, openuser, hardware, createstream flags; and with a valid pcmreadcallback). When I hit a key, it starts playing the sound ( playSound(FMOD_Channel_free, non paused). It is a full second before pcmreadcallback is called, then it is a full second before the sound starts playing since I couldn’t fill it with soudns before. Or should I paused the sound, wait till the buffer got datas via the pcmreadcallback, and unpause it ?
What codecs are the AVI’s video and audio encoded with? If they’re both VFW-compatible, you can use the old VFW API to open and decode the AVI and get audio data to pass to FMod. If not, you’ll have to use DirectShow, and I’m not sure how to do that with VB.net.
- Janus answered 12 years ago
Please login first to submit.