jacobbo / webeye Goto Github PK
View Code? Open in Web Editor NEWWebEye is a collection of .NET controls.
WebEye is a collection of .NET controls.
I have two camera and i want to start CAM1 and CAM2 with two threads
`Thread threadCam1 = new Thread(new ThreadStart(ConnectToCam1));
threadCam1.Start();
Thread threadCam2 = new Thread(new ThreadStart(ConnectToCam2));
threadCam2.Start();
private void ConnectToCam1()
{
try
{
if (string.IsNullOrEmpty(_cam1Setting.IPCAM))
{
return;
}
string cam1URL = "";
cam1URL = string.Format("rtsp://{0}:{1}@{2}", _cam1Setting.UIDCAM, _cam1Setting.PASSCAM, _cam1Setting.IPCAM);
uriCAM1 = new Uri(cam1URL);
liveCAM1.StartPlay(uriCAM1, TimeSpan.FromSeconds(15.0));
}
catch
{
}
}
// ConnectToCam2 is the same
`
but it fired exception Message = "Cross-thread operation not valid: Control 'liveCAM2' accessed from a thread other than the thread it was created on."
How to fix this problem?
Pls help me
Thanks you!
Each instance of control created in auxiliary window (like modal window/dialog for taking person photo) creates a reference to this instance inside Dispatcher.ShutdownStarted event handler.
WebCameraControl constructor - Dispatcher.ShutdownStarted += OnShutdownStarted.
This leads to entire Control - Window - ViewModel and all involved objects not being garbage collected after auxiliary window closing.
It's apparently makes sense to perform cleanup on controls Unloaded event.
I'm developing an IP cameras viewer, that shows live streams from 200 cameras. But I can not create more than 128 instances of PlayerControl.
In StreamPlayerProxy when 127th DLL is loading I get 1114 (A dynamic link library (DLL) initialization routine failed.)
I have found related question in msdn https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/3546c3c4-1b36-4552-85c5-1b3ba860ee84/how-many-dlls-can-be-loaded-in-a-process-using-loadlibrary-?forum=windowssdk
My app can not load 200 external library (unmanaged StreamPlayer.dll/StreamPlayer64.dll) because there are address space limitations.
Do you have any ideas how to create more than 128 instances of PlayerControl?
In my application I'm trying to use multiple instances of control (wanna make video wall with >100 streams), but at some point I get an error "1114 (A dynamic link library (DLL) initialization routine failed.)".
On the internet there are suggestions to use /MD flag which will enable use of dynamically linked runtime and prevent from exceeding limits of address space.
So was there any specific reason to compile with /MT flag?
In WPF if AllowsTransparency=true on a Window then the WebCameraControl doesn't render the video. The webcam is still open and images can still be captured from it.
OS: Windows 7
IDE: Visual Studio 2017
Windows SDK Version: 7.0
Platform Toolset: Visual Studio 2017 - Windows XP (v141_xp)
I have added StreamPlayer and StreamPlayerControl projects to StreamPlayerDemo solution.
In StreamPlayerProxy.cs I changed the load library to _hDll = LoadLibrary("D:\WebEye-master\StreamPlayerControl\StreamPlayer\Debug\StreamPlayer.dll");
so that the DLL I compiled is loaded instead of StreamPlayer.dll from StreamControlPlayer resources.
Now when I run and press play I get
The procedure entry point av_sterror could not be located in the dynamic link library avformat-58.dll
on LoadLibrary(...)
StreamPlayer.dll which I build is only 1.25MB while StreamPlayer.dll bundled as a resource is 12.5MB. Is that the problem? How to correctly build it?
Hi. How can I make the stream into the video file?
Thanks.
I'm trying to stream a live feed of a Foscam FI9826W v2 IPCam through RTSP protocol on a WPF application on Windows 10.
The IPCam uses H264 compression for video and PCM compression for audio.
Your control is great and I was able to get it going in few minutes, but I'm only able to get video, the audio is mute.
I've tried to install various codecs hoping that it would make the audio work, but I failed.
Am I missing something? Have you ever run into this problem?
Hi Guys,
thank you for your good work!
I use this DLL in a my WPF application. I have a user control with the _streamplayercontrol and I load it in a slideshow with other usercontrol in the MainWindow.
After some minutes than the slideshow works I receive this error :
System.ComponentModel.Win32Exception: 'Not enough storage is available to process this command'
at WebEye.Controls.Wpf.StreamPlayerControl.StreamPlayerProxy.LoadDll() in D:\dev\GitHub\WebEye\StreamPlayerControl\WPF\StreamPlayerControl\StreamPlayerControl\StreamPlayerProxy.cs:line 196
at WebEye.Controls.Wpf.StreamPlayerControl.StreamPlayerProxy..ctor() in D:\dev\GitHub\WebEye\StreamPlayerControl\WPF\StreamPlayerControl\StreamPlayerControl\StreamPlayerProxy.cs:line 23
at WebEye.Controls.Wpf.StreamPlayerControl.StreamPlayerControl.CreateAndInitializePlayer() in D:\dev\GitHub\WebEye\StreamPlayerControl\WPF\StreamPlayerControl\StreamPlayerControl\StreamPlayerControl.xaml.cs:line 194
at WebEye.Controls.Wpf.StreamPlayerControl.StreamPlayerControl.StartPlay(Uri uri, TimeSpan connectionTimeout, RtspTransport transport, RtspFlags flags) in D:\dev\GitHub\WebEye\StreamPlayerControl\WPF\StreamPlayerControl\StreamPlayerControl\StreamPlayerControl.xaml.cs:line 79
at WebEye.Controls.Wpf.StreamPlayerControl.StreamPlayerControl.StartPlay(Uri uri) in D:\dev\GitHub\WebEye\StreamPlayerControl\WPF\StreamPlayerControl\StreamPlayerControl\StreamPlayerControl.xaml.cs:line 58
at FCSSupervisorGUI.UserControlsV.UCCameraViewerWebEye.<>c__DisplayClass6_1.<Btn_Click>b__3() in C:\Projects\FCSSystem\Supervisore.NET\FCSSupervisorGUI\FCSSupervisorGUI\UserControlsV\UCCameraViewerWebEye.xaml.cs:line 109
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
When this error happened there is even a visible memory leak.
To solve it, in my user control unload event I try to attend that the dispatcher has shutdown finished but the property is always false.
Thank you!
I am using a Windows 10 Tablet with a resolution of 1920x1200.
The Windows DPI-Scaling is on standard (150% for tablets).
The Video of the camera is only covering 1280x720px of the full 1920x1200px.
If I change the DPI-Scaling to 100% it works perfectly fine.
Is there a possibility to fix the problem with the DPI-Scaling for 125%, 150%, 175%, …?
Hi,
I tried to use StreamPlayerControl and it works fine except there is a 6 second delay in the stream. I've looked into StreamPlayer C++ code but couldn't find anything there that might cause this. I also couldn't build StreamPlayer C++ code, do you maybe have instructions for it? I would like to debug it somehow...
By the way, I'm using a cheap camera but I also tried it in ONVIF Device Manager https://sourceforge.net/projects/onvifdm/ and there live stream worked flawlessly (no delays, perfect image).
Do you have any ideas what might cause this?
I have a tabcontrol with two tabitems. I initialize WebEye in the second tabtite. When I switch to that Item, WebEye is just White. If I initialize it in TabItem #1, it works. Also, if I initialize WebEye on Selector.SelectionChanged on tabitem #2 it still doesn' render anything. Only if TabItem #2 is the default selected item wil it work in TabItem #2
there is the possibility of saving the video?
How can I change resolution oy current image (capture). I have FullHD camera, but I only get 640x480 px. Thank you.
FFmpeg tries first using UDP transport layer, and in case of failure it uses TCP. But due to a bug, during this switch it fails to retrieve the stream properties and fails. The problem is that some IP Cameras are configured only for TCP protocol and don't/can't support UDP, depending on the specific application context.
With the command line command we can use the FFmpeg option "rtsp_transport tcp" to force TCP from the start, so I think this option should be available in your library also (without needing to search for the original libraries and trying to recompile the bottom layer C++ project).
I read the instructions but I can't find the control to add to Visual Designer for my WinForm application.
I'm using VS2015 Update 3.
Hi;
many thanks .
i using your webeye rtsp stream on vb.net. but hi-resolution video is playing slow motion and delayed stream.
i tested 2Megapixel and 3Megapixel videos.
pls resolve this problem.
thanks. best Regards.
What version of "ffmpeg" do you use to compile the "StreamPlayer"
Failed to add a video capture filter
Error Code 0x8004021
this Error is only happening in windows 10 machines. it still works perfectly on other OS
Hi Jacobbo!
First of all I want to thank you for this amazing control.
I can't add any control objects front of the movie.
I try direct drag , set Zindex , look "WebEye.Controls.Wpf.StreamPlayerControl" project and change WindowStyles's parameter (WS_CHILD = 0x40000000, WS_VISIBLE = 0x1000000,) .
But not working.
I want add front of the movie the text and in the work time can change this text.
Please help me.
Hi
I am using this control to show RTSP Video stream. It works perfectly fine with video without any issues but there is no voice.
URL Stream: rtsp://nmbv:[email protected]:1050/cam/realmonitor?channel=1?subtype=0
P.S: I have tested stream on VLC and it shows video with voice. What could be the reason in control.
Thanks
The control worked awesome the first time I tried it.
I used it in my screen capture program and made few videos, it worked fine.
I committed my code to git.
The next time I run my code, the moment when I call StartCapture
method, a COMException
is thrown.
The error code (0x80040217) is different from the similar issue: #3.
OS: Windows 10 Creators Update
Stack Trace:
at WebEye.Controls.Wpf.DirectShowProxy.AddCaptureFilter(String devicePath) in d:\dev\GitHub\WebEye\WebCameraControl\WPF\WebCameraControl\DirectShowProxy.cs:line 200
at WebEye.Controls.Wpf.WebCameraControl.StartCapture(WebCameraId camera) in d:\dev\GitHub\WebEye\WebCameraControl\WPF\WebCameraControl\WebCameraControl.xaml.cs:line 116
at Captura.ViewModels.WebCamViewModel.set_SelectedCamera(WebCameraId value) in F:\GitHub\Captura\src\Captura\ViewModels\WebCamViewModel.cs:line 41
I tested the WPF sample, it too has the same error.
I tested other apps and also the UWP Camera app, they work fine.
I think it is something to do with my system.
Have you experienced the same error?
Hi jacobbo,
i'm thinking to use the WPF control for playing some local videos and rtsp streaming in one wpf app, but i need to pause and set position of the stream (when it's local video), there is any option to do that?
Thanks a lot!
am created an windows app to show multiple camera using RTSP ,but streaming increase much memory space to run.
I have applied this on WPF application but when it runs on x64 systems it runs smoothly but when I run that on x86 systems it crashes.
any help??
Deploying an app using the webcam control works on some computers but fails on others:
Description : le processus a été arrêté en raison d'une exception non gérée.
Informations sur l'exception : System.AccessViolationException
à WebEye.Controls.Wpf.DirectShowProxy.AddCaptureFilter(System.String)
à WebEye.Controls.Wpf.WebCameraControl.StartCapture(WebEye.Controls.Wpf.WebCameraId)
à System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
à System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
à System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
à System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
à System.Windows.Controls.ComboBox.OnSelectionChanged(System.Windows.Controls.SelectionChangedEventArgs)
Any idea what could be the cause of this access violation exception?
I thought maybe the privacy settings of Windows 10 prevents my app to access the webcam. Since my app was not listed under Settings > Privacy > Camera, I went to gpedit.msc
and explicitly asked to allow any app to access the camera. It does not help.
App is running in 64 bit.
Hi,
I am using WebEye on a tablet app and it works fine. My question is how should I handle the rotation of the tablet?
When I start automatically the webcamdevice when the screen is loaded , I get an exception.
If I use the same code to start the camera only when I click the button, it works!
private void InitializeComboBox()
{
comboBox.ItemsSource = webCameraControl.GetVideoCaptureDevices();
if (comboBox.Items.Count > 0)
{
comboBox.SelectedItem = comboBox.Items[0];
var cameraId = (WebCameraId)comboBox.SelectedItem;
List<WebCameraId> cameras = new List<WebCameraId>(webCameraControl.GetVideoCaptureDevices());
webCameraControl.StartCapture(cameras[0]);
}
}
When the code jumps to InitializeCaptureGraph, the program crashes and I get an error "Failed to add a video capture filter"
Any idea how I can make it work?
Thanks,
Hi,
First, this is a nice control :)
However, I found an issue that if I dragged the window to a secondary screen, the video simply froze (not able to RepaintVideo). Hope that you could be able to look into it.
My settings:
Primary screen (left): 3200x1800 with 200%
Secondary screen (right): 1920x1080 with 100%
Hello Alexander,
I found that you also had this StreamPlayer control as part of WebEye which is awesome because the current MediaElement from Microsoft has some unacceptable black frames to them.
However I did find some issues that were mentioned on your Code Project page but I don't have an account there so I will ask here:
In my application the person watching the video will almost certainly want to progress before the local video is finished and I would really need this ability to utilize your awesome tool here.
Can you let me know if there is any chance you will be able to look at this issue in the near future?
Thank you,
Michael
Hello, I have been studying your project and to compile the project and c++ "StreamPlayer" gives an error in lib's libavformat.a, libavcodec.a and in the others.
From where do you generate these lib's to compile the project?
Thanks
Luis Wagner de Almeida
I want to play live video from this URL; but it requiried authentication.
rtsp://192.168.1.244/live0.264?user=admin&passwd=123456
Can you help me?
Is there a way to reduce the delay? Since the newest version you have about 1 second delay.
Hello,
When I'm using WebEye, I have put the control in a couple of WPF pages that you can navigate to on demand. However, I have an issue where if I open a page with the WebEye control, leave the page which should unload that previous page completly and then navigate back to the page with the WebEye control and then I close the application I get the following error that is not trappable and is thrown inside of Visual Studio...
Managed Debugging Assistant 'DisconnectedContext' has detected a problem in 'C:\Users\xxxx\Documents\Visual Studio 2015\Projects\Cube\Launcher\bin\Debug\Launcher.vshost.exe'.
Additional information: Transition into COM context 0x8b4018 for this RuntimeCallableWrapper failed with the following error: The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)). This is typically because the COM context 0x8b4018 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else and cannot process the context transition. No proxy will be used to service the request on the COM component and calls will be made to the COM component directly. This may cause corruption or data loss. To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are available for context transition, until the application is completely done with the RuntimeCallableWrappers that represents COM components that live inside them.
I've tried attaching the source code but I cannot identify the location of the issue as I'm not terribly experienced connecting to COM like you are. It feels like an object was created but not cleaned up in the appropriate time.
I hope that you're still reviewing issues and might be able to shed some light on to why this issue is occurring so that I may correct it.
Thank you,
Michael
As a new c# programmer I am trying to integrate the webcamera control into an existing program. I have )I think) installed all the required bits - and the demo program runs fine on my pc. However I am getting the 'Failed to add a video capture' error when implemented within my own program, with the 'Inner Exception' ArgumentException: Value does not fall within the expected range.
Any help much appreciated!
Hi Jacobbo!
First of all I want to thank you for this amazing control.
I've been using Axis media control (a .NET control from AXIS.COM to play h264 video over rtsp :: https://www.axis.com/no/en/support/developer-support/windows-development ) and when playing 8 streams at the same time I get aprox 7% of CPU usage since the control is using the available GPU to decode the streams (which some of them are VGA and some others are 1080p in quality).
With your control the CPU usage goes up to 17% (on an i7 with 32 GB RAM). Is ffmpeg hardware-accelerating the decode?
Thanks for your time, all the best!
Kiuman
Love your project. I've added to a WPF application we're writing and it works great. I have had no issues getting it to work as we expected. The one thing I can't seem to address is the image size that the WebCamera produces. No matter what I try the only size I can get is 640x480 which is really small.
At first I thought it might be our camera (Microsoft LifeCam HD-3000) but that doesn't seem to be the case. If I open the Windows 10 Camera app and take a picture with it the image size is 1280x720, so the hardware is not the issue.
Is there anyway to set the image size captured? Is there anyway you can add it if that functionality doesn't exist. I'd hate to have to find another control.
when I am trying to connect to play RTSP stream from RTSP URL, I am getting below error :
avformat_open_input() failed: Invalid data found when processing input
I am trying to play stream using this kind of URL .
rtsp://:/video?videosession=23b8ea195fba4d239f7da3a68ef265d4
Please note I can play the stream successfully using VLC player.
Is there a way to place other controls over StreamPlayerControl? No matter which ZIndex property is set, stream overwrites them (is that a problem of using hWnd pointer of a parent window to draw frames?).
Hello,
First of all thank you very much for this amazing control. I have been testing your WPF samples and when I try to start streaming using a wrong url, the application closes abruptly. I have tried to „try catch” the exception in several way but without any success. Do you have any suggestions for a work around?
Thank you in advanced for your help.
Regards,
Diego
there is a memory leak with WebEye.Controls.Wpf.WebCameraId , i have taken the last source today.
However there are less memory leak with the Dispatcher.ShutdownStarted event dependency
thanks
https://snag.gy/w6LG2r.jpg
When playing an RTSP video:
The larger the window, the fewer frames
When playing an RTMP video:
The larger the window, the more frames
This error was tested with different and fast computers. The behavior was always as described above.
It would be nice if you would fix this error 👍
Thank you very much! Otherwise, the player is very good.
Only the possibility is missing, that one can put other elements over the player.
Your control is an extraordinary piece of software.
However, to use it in surveillance application, a stream saving function is necessary.
Most of the Cam application are security related with storage on disk. A picture is only is not sufficient
Please can you consider to add this function to allow a broader usage of your perfect control? I would propose to store the stream in snippets of a definable length in seconds.
Thx, Franz
Hi all,
I have download your demo and code sources. It work greate in my local pc.
But I have confused that is that your streamPlayerControl support play local video files. I noticed that it only support play the uri video in method StartPlay();
Best Regards,
Richard
Hi,
Is there a possibility of handling the preview image?
I'd like to overlay the image being shown on the main box with a transparent one.
Would it be possible?
Best regards.
Winforms.WebCameraControl
start the camera like this, all ok
webCameraControl1.StartCapture(...);
on FormClosing event stop the camera with
webCameraControl1.StopCapture();
and then close the form, on dispose() i get this error
System.UnauthorizedAccessException: 'Accesso al percorso 'C:\Users\rick\AppData\Local\Temp\tmp5E9F.tmp'
When using this component to play an rtsp stream from an IP camera (via a WPF application), the stream is very slow. I believe that what is happening is the stream player's framerate is different from the stream frame rate... so, the camera is getting frames at (for example) 20 frames per second, but the player is playing them back at 10 frames per second without skipping any frames. So not only does the stream appear to be in slow motion, but it also gets more and more delayed as playing continues.
I could be wrong about the cause, but the effect is as I've described.
Any notion of why this might be and what I might be able to do to address it?
Thanks.
If these features are already in the control then please feel free to point me in the right direction :)
Maybe you have already planned these items? :)
Many thanks
Daniel
is there any possibility to implement the project to save video?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.