Click here to Skip to main content
15,867,306 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am developing a website in which users can upload videos.
I am uploading them into a varbinary(max) datatype in sqlserver. This works great, and I can view the video from the stream using a generic handler I have written.

My question is, how can I create a thumbnail for the video?

I have been looking at FFMPEG and related postings; however, this will not work for me because I am not saving the video to a physical path.
I am storing both pics and vids in the sql database with no issues,,, except this one! :)

Does anyone know how I can create a thumbnail from the video upon upload?

Here is the code in the simple handler I am using.

..get the pic
context.Response.BinaryWrite((byte[])v.sVideo.ToArray);

thank you in advance
Posted

1 solution

chevy914 wrote:
because I am not saving the video to a physical path.


If you don't write the video to the file system, then you cannot generate thumbnails. Quicktime allows loading a video from memory, but Windows does not, sadly.

MIDL
double pos = 1;
double percentage = 0.05;

DexterLib.MediaDetClass mediaDet = new DexterLib.MediaDetClass();
mediaDet.Filename = filename;
mediaDet.CurrentStream = 0;
String tmpBitmapFile = System.IO.Path.GetTempFileName() + ".bmp";

int height = 240;
int width = 180;

mediaDet.WriteBitmapBits(percentage * mediaDet.StreamLength, width, height, tmpBitmapFile);


is how I do it, using DexterLib, which is part of Windows.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900