Vorbis decoder for Windows Phone 7 - windows-phone-7

Anyone know of a vorbis decoder library that can be used on Windows Phone 7?
The lack of native code interop make re-using any of the native code implementations difficult (impossible?) but if there are tricks to do that, I'm open to that as well.

There is a managed implementation for mono called csvorbis, it includes a sample which outputs a wav file this didn't need many changes to work with XNA's SoundEffect class. I did a whole track at once, this took a few seconds in the emulator so you may need to stream it using DynamicSoundEffect for better results. The mooncodecs folder has a codec for the desktop version based on csvorbis which may be worth a look aswell.

Ogg Vorbis is not a supported codec on Windows Phone 7 and the platform supports no way of adding support for custom codecs.
The options available are to write your own decoder/converter in managed code or to convert the original source files.
I suspect the second option will be easier.

Related

How to play H.264 video in a win32 window?

I came across a H.264 video which i would like to play in my c++ application. Could anyone suggest what could be the easiest way of doing it? Or What library can be used for the purpose.
Thanks in advance..
Windows API are DirectShow and Media Foundation (mind availability across Windows verions). You need a codec installed in Windows to be able to play the file, stock codec is only provided with Windows 7 editions. A choice of third party codecs is available.
Another option is to use a different framework such as ffmpeg which includes support for container formats and decoders.

Is There a Windows Video Codec Common Dialog?

Does Windows have a common dialog to select video codecs? If there is one, how can I create one in c#? I'm asking because I'm currently developing with a plugin that seems to have included extremely dated codecs, and am not sure if the plugin is simply retrieving a list of codecs from the system. I don't have the source of the plugin, so I can't look at the source code directly.
Attached is a screenshot of the dialog:
Screenshot http://www.freeimagehosting.net/uploads/fb936bd413.png
Thanks!
That looks like the save options dialog from Video for Windows. Specifically, I believe that's the dialog that pops up when you use the AviSaveOptions function from avifil32.dll.
You could probably call that from C# using P/Invoke if you wanted to.
The dialog does get a list of video codecs from the system. However, VfW only supports VfW codecs, not the newer DirectShow codecs. Any of the more modern codecs you might have installed on your system are going to be DirectShow codecs, more likely than not.
If you want a more modern codec, you're going to have to install a VfW version of that codec.
No, there is no directly accessible codecs list available in the form of a CommonDialog in C#.
CFP.

DivX Decoder libraries?

I saw, in an application from a major software vendor a dll called "DivXDecoder.dll" - which intrigued me as (a) it implies the existence of an easy to use divx library, and (b) I'd rather like to play divx compressed movies in a product I work on.
The DivX project itself seems to concentrate on making Codecs and tools for end users. Are there any C/C++ friendly projects that make playback of divx content in Win32 or Cocoa apps possible?
Look at mplayer sources - it uses the ffmpeg library that handles decoding from a number of formats.
DivX is a compressor that conforms to MPEG-4 Part 2. XviD and some versions of Windows Media are also implementations of the standard. So anything that can decompress MPEG-4 Part 2 should be able to handle things compressed with DivX.
As for actual decompression libraries, I'd recommend libavcodec. It's widely-used (= good support), cross-platform, and open-source (LGPL, so can be used in commercial apps). It's also fairly easy to use from it's C binding. It can open and play many different codecs (and with libavformat, handle many different wrappers i.e. avi, mkv, etc.).
If it's Windows-only, using the OS-provided Video For Windows might be a better option if you just want to play MPEG since you wouldn't need to ship it with your app and you avoid potential license issues. Be warned, though, that this requires the user to have certain codecs installed. On Win7 (and Vista I think) the MPEG codecs required to play DivX/XviD are installed by default, however they're not on XP...
Don't waste your time trying to implement DivX playback in a Cocoa application. Use QTKit. If someone wants to playback DivX content in your app they will install a DivX QuickTime plug-in.

Which video and audio format/codec should I use?

Environment: Windows XP/Vista, VS2008, C#/.NET 2.0, VideoGrabber.
Hi All,
I'm writing an app which captures cameras input and encodes them into a movie file (including sound).
My client suggests I encode the movie using the DivX codec. But it's not installed by default and it's not redistributable: Users would have to download, install and configure it themselves.
Is there a Codec available in default Windows (XP+) installations that I could use to encode video and sound? It must support compression. Ideally, I should be able to programmatically set basic configuration.
Note: I read this question but it doesn't actually address my needs.
TIA,
Is there a Codec available in default Windows (XP+) installations that I could use to encode video and sound?
About the best you can hope for is WMV2 (WMV v8). You may be able to encode it using qasf.dll.
The codecs you get for AVI in XP are all woeful efforts from the early days of ‘Multimedia PCs’: things like Cinepak and RLE, which are of zero use for modern full colour/resolution video, and Intel 4:2:0, which is only chroma subsampling, not really actual video compression.
If you need better than that you'll have to start embedding your own codecs, eg. from ffmpeg.
But it's not installed by default and it's not redistributable: Users would have to download, install and configure it themselves.
That's best anyway. Silently installing codecs onto a system is rather antisocial as there are often clashes between them and you could end up messing up other DirectShow applications. For example there are (at least) three different common DirectShow codecs that can handle “DivX” (which is really nothing more than MPEG-4 Advanced Simple Profile video plus MP3 audio in an AVI container): DivX, Xvid and ffdshow. Having more than one installed can be a recipe for bugs.
Not sure how useful this is to you, but I was trying to answer that very question just recently. This article suggests DIB, I420, or IYUV are supported on all platforms... at least in OpenCV. I had the least trouble with I420.

Capturing the desktop with Windows Media Format(WMF)

I am using Windows Media Format SDK to capture the desktop in real time and save it in a WMV file (actually this is an oversimplification of my project, but this is the relevant part). For encoding, I am using the Windows Media Video 9 Screen codec because it is very efficient for screen captures and because it is available to practically everybody without the need to install anything, as the codec is included with Windows Media Player 9 runtime (included in Windows XP SP1).
I am making BITMAP screen shots using the GDI functions and feed those BITMAPs to the encoder. As you can guess, taking screen shots with GDI is slow, and I don't get the screen cursor, which I have to add manually to the BITMAPs. The BITMAPs I get initially are DDBs, and I need to convert those to DIBs for the encoder to understand (RGB input), and this takes more time.
Firing a profiler shows that about 50% of the time is spent in WMVCORE.DLL, the encoder. This is to be expected, of course as the encoding is CPU intensive.
The thing is, there is something called Windows Media Encoder that comes with a SDK, and can do screen capture using the desired codec in a simpler, and more CPU friendly way.
The WME is based on WMF. It's a higher lever library and also has .NET bindings. I can't use it in my project because this brings unwanted dependencies that I have to avoid.
I am asking about the method WME uses for feeding sample data to the WMV encoder. The encoding takes place with WME exactly like it takes place with my application that uses WMF. WME is more efficient than my application because it has a much more efficient way of feeding video data to the encoder. It doesn't rely on slow GDI functions and DDB->DIB conversions.
How is it done?
The source to CamStudio, a GPL'd screencasting app that's been around for years (commercially and then open-srcd later) might be useful?
http://sourceforge.net/project/showfiles.php?group_id=131922
I'd suggest looking at the guts of VNC clients too, though they're probably very simplistic (I think just grabbing screenshots then jpg'ing the tiles that have changed since the last capture).
You might want to consider not using WMV9 as the encoder for on-the-fly encoding if it is too cpu-heavy? Maybe use an older, less efficient compressor (like MS RLE) as used by HyperCam and then compress to WMV afterwards? MS RLE has been a default install since at least Win2000 I believe:
http://wiki.multimedia.cx/index.php?title=Microsoft_RLE
CamStudio's Lossless codec is GPL (same link as above), that offers pretty good compression (though you'd need to bundle the dll in your installer) and could be used on the fly, it works well with high compression on all modern systems.
It's been ages since I've done any Win32 coding, but AFAIK, WMF as a format is basically a list of GDI commands and their parameters which would explain why it is much more efficient to encode...
You'd probably need to hook into the top level GDI context (just as Remote Desktop does, I guess) and capture the GDI commands as they are called. I seem to remember there being some way of creating a WMF output GDI context which means you may be able to just delegate calls to it in some way.
I'm guessing here, but you may be able to find example code for the above in the TightVNC/QuickVNC for Windows projects as they would have to do something like that to capture changes on screen in an efficient way.
Have you checked out the BB FlashBack library?
I am on a similar hunt, and I have just started evaluating the BB FlashBack library.
I am not sure about the external dependencies or install footprint. It appears to have a proprietary codec that has to be installed, but the installation of the codec can be handled by the exposed BB FlashBack API.
Beware, there are licensing restrictions (Runtime setting of license keys, ...)
I can send you the CHM from the SDK via e-mail if you want to evaluate the API before committing to a licensed download.
Things I am in the midst of evaluating:
Proper captures of WPF views
mouse cursor tracking
Size of stored movie
How to display stored movie without proprietary codec (i.e. SWF export)
--Batgar

Resources