# Unity Using a video codec to play animation

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

## Recommended Posts

Hi, I want to have something that plays video files in my program. One opproach is to use a simple window control (Animate window), but it can play only uncompressed *.avi files that (as you know :)) are almost too large. May be someone knows how to use a codec library or something else (I'm raw in this scope), in order to have an opportunity to play vidoe files encoded with Sorenson Video (3), MPEG-4 video, Cinepack, Intel Ideo Video 4.4 or other 'good' codec. Links to tutorials, articles are welcome.

##### Share on other sites
Probably the easiest way to do this is to use DirectShow (documentation is in the Platform SDK, not in the DirectX SDK). That'll use the codecs that are available to all other Windows applications; the only issue would be installing the codecs if the user didn't already have them which could be automated by the installer, or by providing a command script using regsvr32. DirectShow will handle the creation of a filter graph for you, and you'd just need to provide a window handle for it to render to. (There are examples in the Platform SDK).

Video Rendering (DirectShow) on MSDN.

##### Share on other sites
That's what I was looking for, many formats... great :)

From where can I download DirectShow SDK?
OK, suppose it is located in Platform SDK, but
I got error (cannot to open input file 'msvcrtd.lib') while trying to compile a sample code. I suppose that this error is not directly related to DirectShow... but something is wrong :|

[Edited by - VersusOm on April 19, 2007 10:22:26 AM]

##### Share on other sites
Quote:
 Original post by VersusOmFrom where can I download DirectShow SDK?
All of it is in the Platform SDK.
Quote:
 I got error (cannot to open input file msvrcrtd.lib) while trying to compile a sample code. I suppose that this error is not directly related to DirectShow... but something is wrong :|
Which IDE are you using? I assume this is due to your IDE not looking at the right directories. I'm primarily a C# programmer so am not too good with the C++ compilation process, sorry.

##### Share on other sites
I'm using Code::Blocks (+ Microsoft Visual C++ Toolkit 2003).
I recovered from previuos errors, but
I have encountered these ones:
Linking console executable: bin\Debug\GE_0.11.exe
main.obj : error LNK2001: unresolved external symbol _IID_IMediaEvent
main.obj : error LNK2001: unresolved external symbol _IID_IMediaControl
main.obj : error LNK2001: unresolved external symbol _CLSID_FilterGraph
main.obj : error LNK2001: unresolved external symbol _IID_IGraphBuilder
bin\Debug\GE_0.11.exe : fatal error LNK1120: 4 unresolved externals

I have no idea what to do ... load a library like with DirectX?
#pragma comment( lib, "d3dx9d.lib" );

But then the question is what is the name of that one?
P.S. it cannot open 'strmbasd.lib' if I try to load it.

[Edited by - VersusOm on April 21, 2007 3:48:12 AM]

##### Share on other sites
Well, you're missing some needed symbols (GUIDs in this case), so you're probably missing a required library. You mention that strmbasd.lib causes problems; is that because you don't have a strmbasd.lib? Do you have some other sort of strmbas*.lib? Try linking that one.

(strmbasd.lib is probably the debug version of the strmbas.lib, as indicated by the 'd' on the end, and it's entirely possible that the debug version doesn't ship with the Platform SDK).

Failing that, probably the best way is to look in the Platform SDK for the instructions on how to build and link a project that uses DirectShow and follow those carefully. If you can't find those instructions, perhaps grab one of the DirectShow samples and do what it does.

Good luck,
Geoff

##### Share on other sites
I don't know if this is what you are looking for, but perhaps you may be interested in FFMPEG c++ library...

##### Share on other sites
It is working!

Quick Tip for DirectShow :)
// make sure you have this  #pragma comment(lib,"Strmiids.lib");

There is one thing that I have found a bit interesting:
1. I create a window, pass it's handle to interface of DirectShow (IMediaEventEx - for handling events). And as soonn as I start to play, a new window is created with media.
Q: Does anyone know howto make it to work in a main window? Just like other simple controls (Buttons, Statics ect.).
Quote:
 Orginal post by cignox1 perhaps you may be interested in FFMPEG c++ library...
I haven't enough time to explore it in details, but it seems to be a powerful tool. Thanks.

##### Share on other sites
Just in case anyone is wondering about strmbasd.lib/strmbase.lib: The platform sdk only comes with the code for these libraries, but doesn't include prebuilt libs.

##### Share on other sites
Thanks to all.
It is working fine, of course DirectShow clould sopport more various codecs :)

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 11
• 27
• 12
• 12
• 11
• ### Forum Statistics

• Total Topics
631407
• Total Posts
2999914
×