Reputation: 171
I have an an application running as an Azure Web Role where I want to take screenshots of live RTSP video streams on a Wowza server. I am using the NReco FFMpegConverter wrapper. I am having issues with consistency. Sometimes the code doesn't execute at all, sometimes it executes right away, sometimes it take 2-3 minutes for the screenshot to be created. I've tested this on static (not live) mp4 videos and everything is executed flawlessly (within 1-2 seconds).
Stream thumb1 = new System.IO.MemoryStream();
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
ffMpeg.GetVideoThumbnail("rtsp://99.99.99.99:1935/streamurl", thumb1);
//Code to upload file to blob storage
blob = testContainer.GetBlockBlobReference("test.jpg");
thumb1.Seek(0, SeekOrigin.Begin);
blob.Properties.ContentType = "image/jpg";
blob.UploadFromStream(s);
The error I get during failed execution is "Output file #0 does not contain any stream". I am really curious why it takes 2-3 minutes to get an output screenshot sometimes, while other times only a few seconds. Looking for any advice on how to improve this approach and still use the C# NReco wrapper.
Thanks!
Upvotes: 0
Views: 3326
Reputation: 9235
It seems you're trying to get thumbnail from live stream and GetVideoThumbnail method waits for input for extracting first frame of the video stream. Maybe your live stream is badly accessible from Azure WebRole instance (or even not available at all). VideoConverter internally uses ffmpeg and you may check how it performs by connecting to WebRole instance with remote desktop and execute ffmpeg from command line:
ffmpeg -i rtsp://99.99.99.99:1935/streamurl -vframes 1 -r 1 -t 1 -f mjpeg thumb.jpg
Upvotes: 1