Discussion:
How to create thumbnails
(too old to reply)
AndrewAtUnicorn
2008-02-13 23:06:00 UTC
Permalink
We have a system that ingests thousands of video files a day. I need this
system to be able to create a thumbnail from a specified position (seconds)
in a WMV file. Right now we do this by playing the file, programatically
pausing after x seconds, and capturing a screen shot which is then saved
programmatically. This doesn't work so well much of the time.

I need a better way, can anyone give me any suggestions? Our encoder is
programmed in C# using the Windows Media Encoder SDK.
Alessandro Angeli
2008-02-13 23:29:36 UTC
Permalink
From: "AndrewAtUnicorn"
Post by AndrewAtUnicorn
We have a system that ingests thousands of video files a
day. I need this system to be able to create a thumbnail
from a specified position (seconds) in a WMV file. Right
now we do this by playing the file, programatically
pausing after x seconds, and capturing a screen shot
which is then saved programmatically. This doesn't work
so well much of the time.
I need a better way, can anyone give me any suggestions?
Our encoder is programmed in C# using the Windows Media
Encoder SDK.
The easiest way is to use the MediaDet object. You can
import its automation wrapper in .NET:

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Summer_03/directX/htm/mediadetobject.asp

or create a full managed wrapper for it from the C++
interface definitions:

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Summer_03/directX/htm/mediadetobject.asp

The DirectShow.NET project on sf.net might have the wrapper
ready.

Otherwise, you can use the WM[Sync]Reader object in the WMF
runtime (see the WindowsMediaFormat SDK) but you will need
to write a managed wrapper for and DirectShow.NET can only
help so far.

Last, you can use DirectShow through DirectShow.NET:

1. create an empty graph

2. insert a SampleGrabber into the graph

3. configure the SampleGrabber to only accept the
uncompressed video format you like

4. call RenderFile()

5. remove the clock

7. seek to media

8. run and the grabber will provide you with the bitmap

You might also want to mute the audio or add a second
grabber that accepts any kind of audio that you can just
throw away.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Matthew McDermott
2008-05-02 12:03:01 UTC
Permalink
Alessandro,

I am interested in generating thumbnails too. I was wondering if there is a
way to do this "on the fly". Here is the scenario.

I am generating search results from WMV files that have been indexed with an
Audio Video IFilter. The IFilter extracts WMV properties like Title, Artist,
Description, etc. I would like to show a thumbnail of the video.

I think the only way to do this is to render a Media Player Control on the
page for each result. (Though this sounds painful...) I might try it with a
Silverlight control instead.

Do you have any ideas for better options?

TIA!
--
Matthew McDermott, MVP
Principal Consultant
Catapult Systems, Inc.
Post by Alessandro Angeli
From: "AndrewAtUnicorn"
Post by AndrewAtUnicorn
We have a system that ingests thousands of video files a
day. I need this system to be able to create a thumbnail
from a specified position (seconds) in a WMV file. Right
now we do this by playing the file, programatically
pausing after x seconds, and capturing a screen shot
which is then saved programmatically. This doesn't work
so well much of the time.
I need a better way, can anyone give me any suggestions?
Our encoder is programmed in C# using the Windows Media
Encoder SDK.
The easiest way is to use the MediaDet object. You can
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Summer_03/directX/htm/mediadetobject.asp
or create a full managed wrapper for it from the C++
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Summer_03/directX/htm/mediadetobject.asp
The DirectShow.NET project on sf.net might have the wrapper
ready.
Otherwise, you can use the WM[Sync]Reader object in the WMF
runtime (see the WindowsMediaFormat SDK) but you will need
to write a managed wrapper for and DirectShow.NET can only
help so far.
1. create an empty graph
2. insert a SampleGrabber into the graph
3. configure the SampleGrabber to only accept the
uncompressed video format you like
4. call RenderFile()
5. remove the clock
7. seek to media
8. run and the grabber will provide you with the bitmap
You might also want to mute the audio or add a second
grabber that accepts any kind of audio that you can just
throw away.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
babgvant
2008-05-03 13:30:53 UTC
Permalink
On May 2, 7:03 am, Matthew McDermott
Post by Matthew McDermott
Alessandro,
I am interested in generating thumbnails too. I was wondering if there is a
way to do this "on the fly". Here is the scenario.
dssnap (http://babgvant.com/files/folders/misc/entry8759.aspx) is a c#
POC application (source included) that uses a sample grabber to grab
bitmaps. it should work on any file that can be rendered using dshow.
Matthew McDermott
2008-05-03 13:58:00 UTC
Permalink
Thanks, I'll have a look.

What I don't understand is how that application would work on a web page. It
looks like I would have to ues it to create the images as a seperate process.

I was wondering if there is a control or call that I could make that will
render the default preview image from the wmv file?
--
Matthew McDermott, MVP
Principal Consultant
Catapult Systems, Inc.
Post by babgvant
On May 2, 7:03 am, Matthew McDermott
Post by Matthew McDermott
Alessandro,
I am interested in generating thumbnails too. I was wondering if there is a
way to do this "on the fly". Here is the scenario.
dssnap (http://babgvant.com/files/folders/misc/entry8759.aspx) is a c#
POC application (source included) that uses a sample grabber to grab
bitmaps. it should work on any file that can be rendered using dshow.
babgvant
2008-05-04 16:53:13 UTC
Permalink
On May 3, 8:58 am, Matthew McDermott
Post by Matthew McDermott
Thanks, I'll have a look.
What I don't understand is how that application would work on a web page. It
looks like I would have to ues it to create the images as a seperate process.
I was wondering if there is a control or call that I could make that will
render the default preview image from the wmv file?
I don't know of any reason why you couldn't do something like that on
a web page, but getting the pic can take a second or two so you may
want to do it async or better pre generate the images and store them
in a database. Unless you need to great time sensitive (I mean time
within the video) dynamically, pre generating would produce much
better scalability for your web app.
Matthew McDermott
2008-05-05 15:28:01 UTC
Permalink
Thanks, I'll give it a try.
--
Matthew McDermott, MVP
Principal Consultant
Catapult Systems, Inc.
Post by babgvant
On May 3, 8:58 am, Matthew McDermott
Post by Matthew McDermott
Thanks, I'll have a look.
What I don't understand is how that application would work on a web page. It
looks like I would have to ues it to create the images as a seperate process.
I was wondering if there is a control or call that I could make that will
render the default preview image from the wmv file?
I don't know of any reason why you couldn't do something like that on
a web page, but getting the pic can take a second or two so you may
want to do it async or better pre generate the images and store them
in a database. Unless you need to great time sensitive (I mean time
within the video) dynamically, pre generating would produce much
better scalability for your web app.
Alessandro Angeli
2008-05-13 23:56:11 UTC
Permalink
From: "Matthew McDermott"
Post by Matthew McDermott
I am generating search results from WMV files that have
been indexed with an Audio Video IFilter. The IFilter
extracts WMV properties like Title, Artist, Description,
etc. I would like to show a thumbnail of the video.
If you are only interested in WMV, the easiest way to
extract a frame is to use the WMSyncReader object provided
by the WindowsMediaFormat runtime (see the WMF SDK): you
open the file in the reader, seek to whatever point you want
and read 1 frame, which by default you will get as a
decompressed bitmap. Since the reader will seek to a
keyframe regardless of the time you specified, the seek
operation will be fast (as long as the file is indexed).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
antony09
2010-04-20 12:39:01 UTC
Permalink
Try 3D Thumbnail Generator to create impressive 3D thumbnails.


http://www.softorbits.com/3d-thumbnail-generator

Loading...