Hello Folks!
I am trying to cut a thumbnail without having to download the entire video (the video can be huge)
I tried to use the code below, but I am getting the error "Stream must be seekable"
I would appreciate any ideas on how to go about cutting thumbnails from a
url without having to d/l the entire video.
I would also appreciate a critique of my spin lock technique.
==
string fileUrl = "https:/....";
WebResponse objResponse = WebRequest.Create(fileUrl).GetResponse();
Stream stream = objResponse.GetResponseStream();
using (var videoFrameReader = new VideoFrameReader(stream))
{
while (!videoFrameReader.Read()) //Only if frame was read successfully
{
/* Spin lock with sleep for 500 ms till we get at least one frame */
System.Threading.Thread.Sleep(500);
}
using (var frame = videoFrameReader.GetFrame())
{
String thumnailDestination = "Local file path";
frame.Save(thumbnailDestination, ImageFormat.Jpeg);
}
}