locked
thumbnail from uploaded video RRS feed

  • Question

  • User-398804652 posted

    Hi all

    I want to get the thumbnail image from the video uploaded through the file uploader control.

    Please dont redirect to ffmpeg. I was using that and it failed for videos larger than 5 MB. I am restricting the admin to upload only flv videos.

    But i want the thumbnails to be generated from that while uploading, so that i can update database as well

    Saturday, July 18, 2009 8:11 AM

All replies

  • User-398804652 posted

    nobody knows the solution?. I wonder no body used FFMPEG to generate thumbnail images from big flash video files.

    I have been pissed up with this. some body plz help

    Tuesday, July 21, 2009 1:26 AM
  • User-398804652 posted

    hello,

    I am asking about video, not images


    Tuesday, July 21, 2009 1:42 AM
  • User2115139740 posted

    I doubt that you might get exact code, you might have to adjust that code and check out....

    Tuesday, July 21, 2009 1:49 AM
  • User-398804652 posted

    i googled and couldnt find any suitable article.If you provide some links it would be helpful

    I am using the FFMPEG comand like the one below to generate the thumbnail

    string imgargs = " -i \"" + inputPath + "\\" + fileName.Remove(fileName.IndexOf(".")) + ".flv" + "\" -f image2 -ss 1 -vframes 1 -s 152x148 -an \"" + imgpath + "\\" + fileName.Remove(fileName.IndexOf(".")) + ".jpg" + "\"";


    Tuesday, July 21, 2009 1:57 AM
  • User-398804652 posted

    So nobody knows about this? Even there is no way to contact the guys who made the FFMPEG tool. I have wasted my 1 full week in this. There is no method or what to grab the thumbnails while uploading a video? fed up

    Tuesday, July 21, 2009 8:51 AM
  • User951967314 posted

    I tried using Microsft.Expression.Encoder.dll inside my ASP.net application to generate a thumbnail of a video while uploading and the same is working. 

    MediaItem mediaItem = new MediaItem(clientFilepath);
                            MemoryStream memory = new MemoryStream();
                            BinaryFormatter bf = new BinaryFormatter();
                            Bitmap bitmap = mediaItem.MainMediaFile.GetThumbnail(new TimeSpan(0, 0, 5), new System.Drawing.Size(640, 480));
                            bf.Serialize(memory, bitmap);
                            thumbnailBytes = memory.GetBuffer();

    MediaItem mediaItem = new MediaItem(clientFilepath);

    MemoryStream memory = new MemoryStream();

     BinaryFormatter binForm= new BinaryFormatter();


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

    binForm.Serialize(memory, bitmap);

     thumbnailBytes = memory.GetBuffer();


    Hope this helps you!



    Tuesday, February 2, 2010 10:36 PM
  • User-1906510110 posted

    I had created thumbnail from video using "ffmpeg.exe"

    private static void CreateAndSaveVideoThumbnail(string mediaFile, string outputPath)
    {
    Logger(Environment.NewLine + AppDomain.CurrentDomain.BaseDirectory + Environment.NewLine);
    string thumbpath = outputPath;
    string thumbname = thumbpath;
    string thumbargs = "-i " + mediaFile + " -vframes 1 -ss 00:00:05 -s 320x240 " + thumbname;
    var thumbproc = new Process();
    thumbproc.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "\\ffmpeg.exe";
    thumbproc.StartInfo.Arguments = thumbargs;
    thumbproc.StartInfo.UseShellExecute = false;
    thumbproc.StartInfo.CreateNoWindow = false;
    thumbproc.StartInfo.RedirectStandardOutput = false;
    try
    {
    thumbproc.Start();
    }
    catch (Exception ex)
    {
    Logger(ex.Message);
    }
    thumbproc.WaitForExit();
    thumbproc.Close();

    }

    and using NReco.VideoConverter

    private static void CreateAndSaveVideoThumbnail(string inputFile, string outputFile)
    {
    try
    {
    Logger("Input File :" + inputFile + Environment.NewLine + "Output File : " + outputFile);
    var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
    ffMpeg.GetVideoThumbnail(inputFile, outputFile, 5);
    }
    catch (Exception ex)
    {
    Logger(ex.Message);
    }

    }

    Both the codes works fine, but the issue I am having is, it works fine locally but not on Server, It is throwing me error

    "This program is blocked by group policy. For more information, contact your system administrator".

    Tuesday, June 21, 2016 7:02 AM