Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Video Thumbnail generation

i am currently exploring on how to create thumbnail from video file. so far, i am able to generate thumbnail using ffmpeg but can somebody suggest me if there any other ways to generate thumbnail without involving executable(.exe) file.

Thanks, New Learner, Please guide me...

like image 366
Lynx Avatar asked Dec 12 '25 12:12

Lynx


2 Answers

ffmpeg.exe is the best solution for Video Thumbnails generation as it is free software licensed under the LGPL or GPL.

There are few other places where you will find the solution:

C# Wrapper for the AviFile Library

DirectShow .NET

SlimDX is a free open source framework that enables developers to easily build DirectX applications using .NET technologies such as C#

like image 59
Vishal Suthar Avatar answered Dec 15 '25 03:12

Vishal Suthar


If you just need a generic thumbnail an easy way to get one is through the WindowsAPICodePack.Shell package. A small, medium, large, or extra large thumbnail can be generated. There's not as much control over the output as ffmpeg but it's hard to beat this method when a generic thumbnail will do or when avoiding an outside exe.

using Microsoft.WindowsAPICodePack.Shell;
using System.Drawing;

namespace GetVideoThumbnail
{
    class VideoThumbnail
    {
        static void Main(string[] args)
        {
            string videoPath = @"C:\Users\NotSure\Desktop\SampleVideo.MP4";

            // Create shell object
            ShellObject videoShellObject = ShellObject.FromParsingName(videoPath);

            // Create bitmap and/or save locally
            Bitmap thumbnailBmp = videoShellObject.Thumbnail.LargeBitmap;
            thumbnailBmp.Save(@"C:\Users\NotSure\Desktop\SampleVideoThumbnail.bmp");
        }
    }
}
like image 45
Surfinsanta Avatar answered Dec 15 '25 03:12

Surfinsanta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!