Generating thumbnail for a Video uploaded to an Asset library in SharePoint 2010 installed in a Windows Server 2008

I have been trying to generate a thumbnail for Videos after they get added to an Asset Library in Sharepoint 2010 installed in a 64-bit Windows Server 2008 using Event Receivers. This seems to be a pain in the ass for me! :(. I first tried to do it by using MediaItem data type and generating a Thumbnail from it using Expression Encoder object model which is available by adding reference to Expression Encoder 3 SDK dll’s. The problem over here is that Expression Encoder is available only in 32-bit and 64-bit is not available. So, I’m not able to implement it in Sharepoint 2010 which is a 64-bit product. I have also found that none of the Products that are created to generate Thumbnails in Sharepoint were successful to implement this in 64-bit. Hope I be the first one to make it possible! 🙂

Update (10/01/2012):

I’m updating this post almost after 2 years after getting some replies from viewers for a solution. Well, I did finally accomplish this functionality somehow though not with a perfect solution. One of my clients was so adamant to get this accomplished.

So, what I did was,

  1. Created an ItemAdded event receiver for the Assets library which would download the video when the user has uploaded it and stores it in a predefined location in the server.
  2. After it downloads the video it would call a Web service by passing the path of the video file as parameter.
  3. The Web service would generate a thumbnail image from the video using the Expression Encoder API, and then stores the image in a predefined path in the server, deletes the downloaded video and passes the path of the image in the server as a return value to the event receiver. Thanks.

13 thoughts on “Generating thumbnail for a Video uploaded to an Asset library in SharePoint 2010 installed in a Windows Server 2008

  1. Hi Vincent,

    I did not use any product and all dude … i finally developed an event receiver and 2 console applications !!!

    • Thank for your answer,

      I’ve good result with an console application (good video thumbnail from SP2010).

      When a want to call my console application from my event receiver, I’ve no result (black image thumbnail).

      I tried with MediaPlayer API, ffmpeg.exe (problem to load url from sharepoint), i think about a security problem, not resolved wet…

      The only way a found is console application (not schedule by sharepoint) and event receiver who manage a list of duties (video thumbnail todo)

      I going to try with ffmpeg-sharp and i will see, if you have better idea ?

  2. Hi,

    I was able to generate thumbnails using Expression Encoder Object model in my console application. If u can wait until this weekend, u can see a blog post about how I achieved this.

  3. Here is the coding using which u can generate thumbnail from a video using Expression Encoder object model.

    MediaItem finalVideo = new MediaItem(filepath);

    System.Drawing.Bitmap bitmap = finalVideo.MainMediaFile.GetThumbnail(new TimeSpan(0, 0, 5), new System.Drawing.Size(640, 480));

    bitmap.Save((@”C:\Thumbnails\” + filename));

    • Thank for the code,
      but that not resolved my problem 😦

      In my environnement, i’m using Expresion encoder 3.

      MediaItem finalVideo = new MediaItem(filepath);
      Is only for a local or remote path, but not an url.

      All videos i’m using are into Sharepoint 2010…

      I’m trying to found a solution to create thumbnail from the video insert into Sharepoint by another customer.

      PS : Your code is good from remote path using DavWWWRoot in my developpment environnement but not in my integration environnement.

      So i’m carry on digging deeper 🙂

  4. Hi,

    yes u cannot pass a URL to MediaItem…..u need to download the video thru an event receiver and store in the machine and then pass the path of the video to a console application and in that console application generate the thumbnail.

  5. Hi Vinod,
    I am facing same issue. I have used System.Windows.Media.MediaPlayer object for generating Thumbnail in console application. It is working fine in console but I call my console application from my event receiver, I’ve no result (black image thumbnail). It is not able to Open the media properly but not throwing any exception.

    Can I have the solution which you have used.
    Thanks in advance

  6. Hi Eddy and Abhishek,

    Still there are no perfect solutions for this problem. However, I was able to accomplish this by creating an event receiver and 2 console applications.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s