I am working on an existing application written on C#.NET 3.5.
I am looking for a free (open-source if it is possible) library, that allows to play h264 files.
You can use DirectShow and one of many media player controls if you install the appropriate h264 filters along with your app.
Another option is to use a library that has built in decoding, like VLC Dot Net
http://vlcdotnet.codeplex.com/
Related
My goal is to mix 2 audio files that is one voice and one background music. For mixing I am using NAudio.
The problem is I am getting following exception while reading mp3 file using NAudio's Mp3FileReader.
DllImport cannot be used on user-defined methods
I am using NAudio in Windows Phone 8.1 Silverlight app project. I am not sure if NAudio is useable on WP Silverlight app if its useable then please help by providing a code example or suggest any other library or custom implementation to mix 2 audio files.
No, I'm afraid NAudio is not usable on Silverlight, as it makes lots of calls into Windows APIs which you can't do in Silverlight. You can take a look at the NAudio NLayer project which offers fully managed MP3 decoding. You could use that in conjunction with some of the more generic helper classes in NAudio like the MixingSampleProvider to perform the mixing you require. Of course the next issue would be what you want to do with that mixed audio. Silverlight does have a way of streaming user generated audio using the MediaElement but NAudio does not provide support for this directly.
[DllImport] requires a substantial chunk of code in the CLR, nothing very subtle about the pinvoke marshaller. That's a problem on a phone, it runs a special version of the CLR named .NETCore. Probably better known today as the codebase that spun-off the CoreCLR open source project. Keeping it small required unsubtle choices, pinvoke fell on the floor.
So no, you'll have no use at all for NAudio. You'll have to dip into the built-in support for audio. The relevant oversight MSDN page is this one. This blog post is relevant.
As you can tell, XAudio2 is your ticket with direct support for mixing. There is a learning curve of course, the language is probably the first obstacle given the question tags. Get started with this sample to get the basics.
Maybe you should consider taking the step to upgrade from WP8.1 Silverlight (WPS) project to WP8.1 (WinRT) one so that you have better access to audio APIs...
...or directly to a UWP/Win10 app (if you don't plan to release immediately to phones). If you choose that path, you could try maybe a free preview tool that converts WPS to UWP, just released from Microsoft and Mobilize.NET - https://blogs.windows.com/buildingapps/2015/09/17/initial-preview-of-silverlight-bridge-to-uwp/
I'm looking for a way to stream video from an AXIS M10 IP camera, and display the feed using windows forms (or better, wpf). However, it need to be running on 64-bit platform.
This means that I can't use the AXIS Media Control ActiveX component.
Also, I found that these methods work but only in 32bit environment:
1.Using MediaElement Class for WPF
2.Using embedded media player
3.VlcLib (for dotnet)
So far it looks like my only option is to directly implement RTSP protocol and decode the given RTP/AVP stream using Media Foundation (for .net) and display it somehow. (I was able to get the camera to stream to a UDP port using RTSP calls).
I'm fairly new to RTSP/streaming, so I'm concerned that I might be missing the big picture - Will I be able to use media foundation to render/display videos on winform/wpf, or do I have to look at that functionality elsewhere?(from my research it looked like it could decode H.264 streams, but I did not see any video-playing capabilities). I also came across DirectShow - should I use DirectShow over Media Foundation?
Or better yet, is there a library that is able to handle RTSP streaming that runs in 64bit?
VisioForge Video Capture SDK .Net for example (but commercial), WPF controls included.
Decoding using FFMPEG, with DirectShow engine. Really, I don't see any Media Foundation advantages here.
Also any other way using FFMPEG.
Or, you can write RTSP source filter (based on DirectShow Push Source sample) with H264 output pin for video and G726/G711/AAC for audio. Also you can made virtual video capture source filter and use it in MF or DirectShow. You can use live555 library for RTSP implementation.
So, no simple ways here, if you are starting from zero.
If you just need the Video, I would prefer to just display the MJPEG stream of the camera. This is really easy done without the complexity of DirectShow or MediaFoundation. I display 12 cameras at the same time in my application with this little library in WPF: MJPEG Decoder. You can also use it in WinForms. It decodes the MJPEG Stream and gives you the images to display.
The 64 bits Axis Media Control SDK is available now, but requires an account on Axis web site to be downloaded.
After Sign in, you need to join Axis Developper program (free) and download the AMC SDK.
You will install a executable file (.exe), this install all the libs and samples in your Drive
C:\Program Files\Axis Communication\SDK
I found a way to use VLC in 64bits without ActiveX DLL :
The VLCSharp Library is composed of multiple NuGets to use VLC Player on severals platforms (WPF, Winforms, Xamarion, TvOS).
It is working fine on Onvif Cameras
I have raw H264 video data that I want to wrap into some kind of container format so that I can play it in a video player like WMP or VLC, and I want to do this in .NET (C#), or C++. What is the easiest approach? Does anyone know of a free/open source SDK that would make this easy?
You can simply play it through a WPF media element if the computer has the appropriate Codec's installed.
I've been facing a road block in trying to incorporate .ogg and .mp3 files in a WinCE 5.0 (build 1400) environment. Many of the answers I've found require some part of the Directsound libraries which are no longer supported.
Is there any way to implement playing of .ogg and .mp3 files on WinCE 5.0 without using Directsound libraries?
For this situation I would recommend taking a look at GSPlayer or TCPMP Player (open source software, C++), you could use the code to create a dll. GSPlayer uses WaveOut internally, so no worries about DirectSound. However you will need to check the license and make sure you are not violating it. After creating such dll you could use it with p/invoke.
If you are the OEM of your target device, another option that excludes .ogg would be to add Windows Media Player Control in your OS image, and use it from C# as an ActiveX control. There is more information on how to do this here, here and here
Update:
In answers to a similar question it is recommended to use FMOD, although this is not free for commercial use as #mack369 pointed out in a comment.
I'm using .NET Compact Framework 3.5 and I'm wanting to crossfade two tracks of music.
The time at which they would crossfade isn't known, the idea is one would loop and something would trigger a crossfade.
I know SoundPlayer can play multiple tracks on top of one another and that (though I've not been able to get it to work), WaveOut is able to control volume (maybe fade?!).
Is there any way of incorporating these functionalites?
Thanks
the audio capabilities built into .NET CF are quite limited. for serious audio capabilities, you'll need to use a separate library - FMOD is popular for this.
.Net CF runs on multiple type of devices with different capabilites. Depending on the specific features of your target device, you might be able to use Windows Media Player activex control. OpenNetCF team has a commercial component allowing to use this activex control from .Net CF.