RTSP video stream freezes
Summary
The stream from the RTSP camera freezes up. Initially it works fine and I can view the stream, but it randomly freezes up after 5-45 seconds.
To get the stream onto a texture I modified the included example by changing the UseRenderingPlugin script. In the PlayPause() method I changed this line only:
_mediaPlayer.Media = new Media(_libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", FromType.FromLocation);
changed to:
_mediaPlayer.Media = new Media(_libVLC, "rtsp://PIFDesign:2308@192.168.1.109/live", FromType.FromLocation);
As I said, initially the stream displays fine and runs for a few seconds before it freezes. There is a timestamp in the corner which stops counting. Strangely the audio does not freeze, and I can still hear it after the video freezes.
The stream is coming from a WYZE Cam v2 running custom firmware for RTSP. I know you can't reproduce this exact stream but since the stream is working in VLC media player for Windows I believe the stream is not the problem.
Minimal project and steps to reproduce
- Start a new project in Unity
- Import the VLC for Unity (Windows) from the asset store
- Open main.unity scene
- Open UseRenderingPlugin script and edit line 60 under the PlayPause() method to:
_mediaPlayer.Media = new Media(_libVLC, "rtsp://PIFDesign:2308@192.168.1.109/live", FromType.FromLocation);
- Press play and start the scene.
What is the current bug behavior?
Video freezes after a random amount of time, less than one minute. Audio keeps streaming. Video stream may unfreeze for a second or two before freezing again.
What is the expected correct behavior?
Video should continue to stream without freezing. It should show updated time stamp even if there is no motion.
Does it work on other platforms? Does it work with the official VLC apps?
Stream of RTSP camera works with VLC media player on Windows 10, without video freezing. Works in other RTSP viewer apps on Windows.
Relevant logs and/or screenshots
Unity Log produces only 2 elements:
[VLC] Toggling Play Pause ! UnityEngine.Debug:Log(Object) UseRenderingPlugin:PlayPause() (at Assets/VLC-Unity-Windows/Scripts/UseRenderingPlugin.cs:48) UseRenderingPlugin:Awake() (at Assets/VLC-Unity-Windows/Scripts/UseRenderingPlugin.cs:21)
Creating texture with height 1080 and width 1920 UnityEngine.Debug:Log(Object) UseRenderingPlugin:Update() (at Assets/VLC-Unity-Windows/Scripts/UseRenderingPlugin.cs:92)
VLC media player for Windows does not produce a Log when stream is played.
Environment
- OS: Windows 10
- Version 10.0.18362 Build 18362
- Device: Windows PC custom build
- LibVLC version and architecture: (?whatever is included in asset package)
- LibVLCSharp version: (?whatever is included in asset package)
- VLC Unity plugin version: Version: 0.0.5 • Mar 17, 2020
Possible fixes
¯_(ツ)_/¯