I am developing a Window7, C#/WPF based GUI and I want to show H.264 video which I get from the RTP stream of a video call. I am using a C based open source library for making the video call. This is what I want to implement: The user dials a URI by typing in the address and pressing the call button and when the video call is established the H.264 stream is seen in the WPF GUI window.
Does the latest WPF support H.264? If not, what other windows based framework/technology can I use to show H.264 video on Windows 7?
Yes, WPF VideoElement can show H264, if you have latest windows media player installed(I think windows7 has WMP installed by default).
If that doesn't benefit you, you can always use MediaKit that can do everything: http://wpfmediakit.codeplex.com/ (you can feed your own DirectShow graph to VideoElement by registering new protocol - basically means anything is possible this way)
Related
Is there any way in c#/.net of recording the current audio being played? I've searched a lot on the internet but the only result I could find is recording using a microphone.
I dont want to record using microphone input, I want to record what is being played on the computer when I click a record button.
Thanks
You have two options here:
Hardware loopback device - virtual "Stereo Mix" audio device, which acts as a regular audio capture device and in the same time produces a copy of mixed audio feed played through default audio output device of the system. Since such device shows up as real audio input device, you can use standard APIs, libraries and even exitsing applications to record from such device.
Programmatic access to a virtual loopback device as if it was microphone-like device. API on the background will duplicate played audio content and make it available for reading back as it plays. The good news is that you can access the mixed audio feed for device of your interest.
Both options are described in detail in Loopback Recording article on MSDN and available via standard audio APIs, specifically WASAPI.
For C# development you are likely to use a wrapper like NAudio.
For option 1 you will find quite a few questions on StackOverflow, and for the other option the keyword is AUDCLNT_STREAMFLAGS_LOOPBACK.
The only way to be able to receive data from another application is if the developer provides an access point, normally through some SDK, API, or other means. Without this, there is no way for your application code to receive the bytes from the other application.
The reason a microphone works is because it is receiving the sound output bytes from the application and sending those soundwave bytes back into your PC to render and output the sound. Since you have access to these bytes from the microphone you are able to capture the sound.
See if there is an API or an SDK from the developer of the application you are trying to get sound from.
There are a quite a few of sources to get a video stream from webcam into a picturebox embedded in a userform.
Preview a camera in DirectShow and capture a still image - in VB.net
How do i use attached webcams to take still image in my application
However, I am trying to do something a little neater, basically have a the preview of the video stream from webcam in a control that is embedded directly into the sheet rather than on a floating userform. I am not sure if this possible. I would very much appreciate any pointers.
(Answer from TnTinMn's comment - Posting as an answer to remove from 'Unanswered' queue)
If you can write a .Net WinForm UserControl to view your video stream, then you should be able to produce a ActiveX UserControl that you can utilize in Excel.
Get the Microsoft InteropForms Toolkit 2.1 .
Even though it was originally intended to allow .Net UC usage in VB6, it works fine to write UCs for use in Excel.
As a test, I just wrote one that used the Windows Media Player and it played the video fine as a UserControl on the worksheet.
Start VS as an Admin as it needs to be able to register the control.
I would say build a Form with TopMost = True
Then you can display your webcam video in this Form
and put it anywhere you want.
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 am building a sip softphone in C#, I am through with the audio aspect, but I want to add video call capability to it, I can successfully get image from the webcamera on the system, but the problem now is I want to compress the image using h.263 codec algorithm before sending it over udp in realtime, all the codes I have been seeing on h.263 is in c++, and I am not a C++ person, please how can I implement this in C#, I mean get the video from the webcamera, encode in h263 and send it over wire in realtime, any suggestion will be highly appreciated
If you want to do real-time streaming over UDP with both audio and video stream you can use the DirectShow API (if you're targeting Windows computers). Official documentation available here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375454(v=vs.85).aspx
You will find a .NET wrapper for DirectShow here: http://directshownet.sourceforge.net/ and also some samples.
You will also find more samples on codeproject.com, most of them use this wrapper: http://www.codeproject.com/kb/audio-video/#DirectShow
Using DirectShow you will be able to capture both the webcam and the microphone in realtime, encode them using the appropriate encoder filter (for instance, a h263 encoder for the video stream) and then send the encoded frames over the network using a RTSP writer filter.
I'm not an expert on DirectShow, but this could be a good starting point. I know this solution works because I've implemented it few months ago.
You need to know that DirectShow is beeing deprecated since Windows Vista, and is beeing replaced by the new API: Windows Media Foundation. If you're targeting Windows Vista or Windows 7 only, it may be a better choice to use the new API. See the MSDN documentation for more details: http://msdn.microsoft.com/en-us/library/windows/desktop/ms694197(v=vs.85).aspx
Hope this will help you.
I want to add a video player in my Windows Form that would be able to stream videos (flv) from internet (web-server). So far i've tried Microsoft Windows Media Player and it's working but I don't like it because of its lags and bugs and etc.
So are there any other video players that can be easily embedded in a Windows Form and that support video streaming? (by streaming I don't mean something like live TV streaming, but just downloading (buffering) and playing at the same time the video)
Perhaps you can embed VLC as an ActiveX component?
There is a Flash ActiveX control which (I expect) would handle these natively.