locked
How to take a snapshot pic from a (.mp4/.3gp) video file ? RRS feed

  • Question

  • User-447304247 posted

    Hello there,

    I need some help with video embedding in ASP.NET. So I am developing a litle custom blog and I need users to upload Quick Time videos (.mp4,.3gp) but I also need when upload completes to take a snapshot from the uploaded video which should be used as a link to a page that plays the video, in other words I need to take a frame from this video file... Do you have any idea how this is possible??

    Thanks in advance

    Thursday, March 8, 2007 5:15 AM

Answers

  • User-447304247 posted
    ok finally the answer is the http://ffmpeg.mplayerhq.hu/ tool.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 29, 2007 9:29 AM
  • User-447304247 posted
     

    Well my friend you are very lucky because I have to wait more than two weeks to find the answer.

    Everything you need is that:

    1) To extract image from video do:

    Process p;
    ProcessStartInfo info = new ProcessStartInfo();
    info.FileName = "ffmpeg.exe";
    info.WindowStyle = ProcessWindowStyle.Hidden;
    info.Arguments = " -i " + your_video_name + " -vframes 1 " + your_extracted_image_name + "%d.jpg";
    
    p = Process.Start(info);
    
    while (!p.HasExited) { Thread.Sleep(10); }
     
     Some notices:
         1.-vframes 1 - will extract image from the first frame 
         2.%d - is a ffmpeg.exe parameter which is usefull for autonumbering of image name (it is the it works)
    2) If you need to convert your video to another video format do something like the follow:
     
    info.Arguments = " -i " + video_file_name_to_convert + " -ar 44100 " + new_flv_name + ".flv";
       
    p = Process.Start(info);
    
    while (!p.HasExited) { Thread.Sleep(10); }
     That use of ffmpef.exe will convert your video file (on my project was a .3gp) into .flv video. The "-ar 44100" is something that I do not remember (see the reference).
     I check HasExited property to be sure that the program execution has finished.
    Good luck - you will need it ;) 
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 9, 2007 10:53 AM

All replies

  • User1415983342 posted

    If youк page embeds and plays the video, then you are using streaming server

    Usually, streaming servers come with corresponding SDK for manipulating videos
    http://www.umediaserver.net/source.html

    or google with keywords C# streaming media Server

    Thursday, March 8, 2007 11:17 AM
  • User-447304247 posted
    My video should play to onether page so I don't need any streaming service here. I just need to take a frame from the movie that user uploads and to create a snaphot for that movie (by storing a new image), when user clicks will redirect to a PlayMovie.aspx page. But I can't find the appropriate API to do that, any suggestion for that?
    Thursday, March 8, 2007 1:45 PM
  • User-447304247 posted
    ok finally the answer is the http://ffmpeg.mplayerhq.hu/ tool.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 29, 2007 9:29 AM
  • User-1538088162 posted

    Hi,

    My requirement is that I would like to make a thumbnail for a video on the fly. i.e. users will upload videos and the program should be able to make a thumbnail from them. And when they click on those thumbnail the video will play in a different page on my website.

    Now I have managed to make a thumbnail from a picture.

    To make a thumbnail from a video I should be able to capture a frame form the vidoe as picture and then convert that picture a s athumbnail. So what I should be now looking for is a code which captures a frame from a video as picture. AM I CORRECT?

    OR IS THERE ANY OTHER WAY TO CREATE A THUMBNAIL FROM A VIDEO.

    I am using a windows player and not a flash player like most of the site like youtube, myspace, etc are having. So basicaly I will be converting any video format to windows format. (infact I am looking for that free convertor too). i will be streaming the vidoes on demand.

    Please give your valuable suggestions considering the above situation. If possible can anyone give a complete code for the same.

    regards,


    Ajeetpal singh

     

    Thursday, August 9, 2007 8:37 AM
  • User-447304247 posted
     

    Well my friend you are very lucky because I have to wait more than two weeks to find the answer.

    Everything you need is that:

    1) To extract image from video do:

    Process p;
    ProcessStartInfo info = new ProcessStartInfo();
    info.FileName = "ffmpeg.exe";
    info.WindowStyle = ProcessWindowStyle.Hidden;
    info.Arguments = " -i " + your_video_name + " -vframes 1 " + your_extracted_image_name + "%d.jpg";
    
    p = Process.Start(info);
    
    while (!p.HasExited) { Thread.Sleep(10); }
     
     Some notices:
         1.-vframes 1 - will extract image from the first frame 
         2.%d - is a ffmpeg.exe parameter which is usefull for autonumbering of image name (it is the it works)
    2) If you need to convert your video to another video format do something like the follow:
     
    info.Arguments = " -i " + video_file_name_to_convert + " -ar 44100 " + new_flv_name + ".flv";
       
    p = Process.Start(info);
    
    while (!p.HasExited) { Thread.Sleep(10); }
     That use of ffmpef.exe will convert your video file (on my project was a .3gp) into .flv video. The "-ar 44100" is something that I do not remember (see the reference).
     I check HasExited property to be sure that the program execution has finished.
    Good luck - you will need it ;) 
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 9, 2007 10:53 AM
  • User-1538088162 posted

    Hi!,

    Thanks for your help. I am working on it. But I am getting an error....I am using a .3gp file to capture a frame. I am getting an error invalid output format. Also when I run the program it does not show any output in the browser. I want to see the output in the browser before I use the thumbnail part on that picture just to be sure I am on the right track. also I am not able to find where the picture is getting saved..

    help required....

    Regds,

    Friday, August 10, 2007 4:43 PM
  • User-447304247 posted

    Well thre are some things to see on the previous example:

    1)  The "video_file_name_to_convert" parameter should be something like "c:\inetpub\wwwroot\mysite\videos\video_to_convert.3gp". Ofcourse this file should exists, so maybe that causes your problem...!!!

    2) The new_flv_name parameter should be something like "c:\inetpub\wwwroot\mysite\videos\converted_video.flv".

    3) The your_extracted_image_name parameter should something like "c:\inetpub\wwwroot\mysite\images\your_extracted_image_name" + "%d.jpg". The %d is an integer that is automatically generated from ffmpeg program.

    4) The path c:\inetpub\wwwroot\mysite\ is probably your root path of your web site to take that dynamically write something like Server.MapPath("~/videos/") or Server.MapPath("~/images/") for storing videos/images respectively.

    Friday, August 24, 2007 1:46 PM
  • User-176525855 posted

    Hi

    I am  using web viedo control in my application but here

    iam un able to upload the .mp4 videos

    suggest me the control to upload  the .mp4 video file

    Asp.net using C#

    Thursday, July 24, 2008 1:28 AM
  • User1448906665 posted

    you can try http://www.all4dotnet.com/

    Thursday, April 9, 2009 1:58 AM
  • User492839198 posted

    hi


     Its payable..

    If you have its free version please send it to me on humill_bca@yahoo.com with subject videp snap.


    Thanking you,


    Sunday, February 21, 2010 10:20 AM
  • User492839198 posted

    use ffmpeg its very useful for small and large video conversion.

    type ffmpeg in the google. Read it carefully...

    Thursday, February 25, 2010 5:25 AM
  • User-31526489 posted

    check this i found a near subject on this blog hope it will be usefull for u http://blog.waleedmohamed.net/2010/04/convert-avi-video-to-jpg-images-capture.html

    Wednesday, April 28, 2010 9:16 AM
  • User-540411456 posted

    U can try using "DVD Decompiler"

    It's free & I always use it for taking snap shots from vids & movies.

    I once made another movie using the images taken by it :D as i took sequence of screen shots(it has an option which can do it ).

    You Can download it here:- http://www.Soundindepth.com



     

    Thursday, August 5, 2010 3:32 AM