C# Streaming from Panasonic IP camera using RTSP - c#

I want to receive an RTSP stream from a Panasonic camera (Model WV-SPN531) and display the live video in my C# Form application.
If I use VLC and connect to "rtsp://IP_ADDRESS/MediaInput/h264/stream_1" the streaming works fine.
Codec: H264 - MPEG-4 AVC (part10) (h264)
Resolution: 1920x1080 (15 FPS)
I have tried this library, but it does not work: http://net7mma.codeplex.com/ .
I wrote to the developer of the library and I described the problem and he replied that: "There's not an available MPEG decoder in C# right now, not one which I know of immediately anyway."
Can you help me?

I have used this SDK to play RTSP video in C#
https://sourceforge.net/projects/onvifdm/files/%21sample_winform/
It uses a hosted executable to play the video but works very well
I also tested https://github.com/ZeBobo5/Vlc.DotNet before hand but the performance was a bit choppy compared with the above.

I am using the Datastead Rtsp source SDK to capture Panasonic, Axis and some other IP cameras.

Related

Windows 10 usb camera not working from code but works from other programs

I am unable to create an application in any programming language that will playback video from a usb webcam.
I want to display video feed from a webcam, and then take a snapshot of a frame at the press of a button.
The existing program uses avicap32.dll and works fine on older versions of windows, but does not work on windows 10.
On windows 10 I tested that VLC is able to playback the webcam from dshow, and it is able too. I then made a c# application that used a libvlc wrapper to play the webcam, and no video is ever loaded. However the light on my webcam lights up while the app is running. If i take the application and move the webcam to a windows 7 pc video plays in my c# app.
I then tried ffmpeg, running ffplay from command line plays video from webcam no problem. I made a c# app that will create a new process and run the ffplay exe with arguments. I get an error in the ffplay output saying it could not find the video format.
I then tried running ffplay from a subprocess in python, basicaly the exact same thing as the c# app above. This time video playback is successful.
I figured it must be something to do with c#. So I made a quick c++ application that uses lib vlc to play dshow://. I get no video playback but the light on the webcam turns on. If i move this c++ application to the windows 7 machine the application works and displays video from the camera. (this was made using mingw and not visual c++)
I also attempted to use directshow but that also did not work. just got a black image, and was unable to copy frames.
The strange thing is I was able to use the Universal app c# examples from microsoft and it is able to use the webcam. I have to give the example application permission to use the webcam first.
Furthermore, I know the webcam is working fine on the windows 10 machine because the Camera app in windows 10 works fine, vlc works fine, and ffplay work fine.
Does anyone know what is going on here? Is microsoft playing games? Are they forcing people to use univeral apps if they want webcam access? How is VLC, FFMPEG. working they'r not universal apps.
Update:
I'v still had no luck getting a winforms application to display an image from the webcam, however, I decided to use Process to start my python script that starts ffplay, and suprisingly I got the same error message i got when just directly running ffplay from c# using process. The error im getting is
"Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 640x480): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, dshow, from 'video=Logitech HD Webcam C615':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 640x480, 30 fps, 30 tbr, 10000k tbn, 10000k tbc"
UPDATE 2:
I'm surprised of how little information online is available on this topic. However for those of you in the future that face this problem. I found a article on the Microsoft website, that states that the new app security mechanism in windows 10 version 1809 prevents any application from accessing camera's and microphones unless they are UWP, and have permissions. However, if the application knows how to directly communicate with the device bypassing windows libraries it is possible for that application to still use the camera. https://support.microsoft.com/en-us/help/4468234
This is where I ended, I am going to make a UWP app with a tcp socket server to broker webcam images to my old software.

Video player for application that loads RTMP feed

I am looking to integrate a RTMP player into an application I am creating to play a local live RTMP feed.
Could anyone recommend any good players? I've been looking at OSMF Strobe Media Playback but have not pulled the trigger yet.
You can find a C# RTMP implementation here.
It is tested to work on Windows, iOS and Android. You do need BASS to output audio. Video is not supported but the base RTMP client code (NetStream) exposes an event which gives you the video data as they arrive from the server.

Axis Camera video streaming with C# 64bit

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

Save Kinect's color camera video stream in to .avi video

I want to save the video streams that is captured by Kinect's Color camera to .avi format video, I tried many ways of doing this but nothing was succeeded. Has anyone successfully done this? I'm using Kinect for Windows SDK and WFP for application development
I guess the easiest workaround would be to use a screen capture software like http://camstudio.org/.
There is also post with the same question her:
Kinect recording a video in C# WPF
As far as I understand you need to to save the single frames delivered by the kinect by into a video file. This post should explain how to do it How to render video from raw frames in WPF?.
You can use the AVIFile Windows API using interop:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd756808(v=vs.85).aspx
or you can use a wrapper like this one, done by Corina John
http://www.codeproject.com/Articles/7388/A-Simple-C-Wrapper-for-the-AviFile-Library

How do I encode an image in H.263 and send it in real time using udp

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.

Categories

Resources