Archived

This topic is now archived and is closed to further replies.

Playing synced Video and Audio from an AVI file

This topic is 5849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys. This is my first post here, and I''m looking forward to hanging around for a while. Graphics are one of my hobbies, I guess...I''m a CS major at a school that only has one graphics class. :-\ First and foremost, before I ask my question, I would like to extend my sincerest condolences to Nehe. I know this is my first post, but I''ve been visiting his site for quite some time. May God hold you close. Now, my question: I''m doing a project for this Interactive Graphics class and thought that throwing in a movie on the side of a polygon would spice things up (I''ve modeled R2D2 and I thought it would be cool for him to play a movie). Thanks to tutorial #36 on Nehe''s site, I''ve got the video playing, however, it lacks sound and I''d like to get that working, if I can. Do any of you know how to get that sucker to play audio as well as video, hopefully without altering too much of the original code? I''m slogging through the MSDN right now, trying to figure out exactly how I''m supposed to initialize DirectSound and then to play the buffer (I think I''ve got the sound pushed into a buffer that''s ready to play). Do you guys have any suggestions? Also - I''ve been through the Resources and FAQ, and I''m a little closer to understanding what I''m supposed to do, but I''m not quite there. I''m more or less a Windows programming newbie, and we''re using GLUT for this class (I know - I''d rather learn the Windows code myself, but I have to turn in GLUT code). Thanks! Vash

Share this post


Link to post
Share on other sites
Take a look at the documentation for DirectShow (assuming you have DirectX 8). Also take a look at the samples: The "Texture3D" sample shows the use of a media file as a texture. The "Play Window" sample (amongst others) shows the playback of a media file with audio and visual content.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
actually the textures3d sample does not play any audio at all. and is quite tricky to get audio working fully for all formats due to pin problems (not tough just tricky).

audio wise, the avi system in windows has the ability to parse and playback audio. msdn should have much info on this when they discuss howto play avis. look into the capturing and writing of avis as well (since most of the write functions have reciporical read and play functions). you may even be able to coax video for windows to play the audio and video synced.

the reality of this is harsh though, the avi video for windows system is very outdated. this is the reason it is a bit tough finding lots of good resources on it. the directshow system while infinitly more flexible, easier to manage, and better in nearly every respect to its video for windows counterpart, gets confusing to use with opengl. this is mainly because nearly all the directshow samples are for directx apps (rightly so since you use opengl for cross platform stuff, and some ppl like the api better/some features of cards may be exposed better via opengl extensions).

personally i use directshow with dx8 and videos play wonderfully on textures with full sound (even mulitple video play back is possible with the system i set up). i highly suggest wraping all the init and control stuff in a class. manily because initializing directshow with a movies using the method shown in the textures3d sample can get hariy once you start adding support for sound. the graph filter editor will be yoru friend since you can see how the movies will be rendered and how the filters pins hsould be connected (dont worry baout the terminology if you dont understand it, it makes sense once you raed the docs on directshow).

btw you dont need dx8 for directshow, its been a part of directx since version 6.

Edited by - a person on December 9, 2001 11:22:34 PM

Share this post


Link to post
Share on other sites
quote:
Original post by a person
actually the textures3d sample does not play any audio at all.



Thus me mentioning two samples..., one to show decoding some form of video stream into a texture, another showing code to play back audio synchronised with video using DirectShow.



quote:

btw you dont need dx8 for directshow, its been a part of directx since version 6.



Almost... DirectShow has been around since the days of DirectX 6 (even earlier in fact), but it has not been a part of the DirectX SDK since then. It was always a separate SDK, "The DirectMedia SDK", a separate download, a separate CD, a separate runtime installation. Recently they split it up so that the DirectShow components are now part of the DirectX SDK, and the codecs and other tools are part of the Media Player toolkit...


--
Simon O'Connor
Creative Asylum Ltd
www.creative-asylum.com

Edited by - S1CA on December 10, 2001 8:40:43 AM

Share this post


Link to post
Share on other sites