Welcome, Guest
  • Author Topic: Make screenshots of video to jpg  (Read 6518 times)

    curlyfro

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • OTBRadio
    Make screenshots of video to jpg
    « on: 10/13/05, 22:07 »
    hi Jorge,
    i read your tutorial http://www.flash-db.com/Tutorials/snapshot/index.php and it's a bit overwhelming for an actionscript newbie like me.  however, this is exactly what i want to do.  i've been searching for this solution for weeks.  i have a bunch of .flv videos i recently converted from .wmv.  from actionscript i want to move to a specified index in the flv (say 5 secs), capture the jpg, and save the jpg to disk.  given your tutorial, how would i do this?

    thanks.

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Make screenshots of video to jpg
    « Reply #1 on: 10/14/05, 02:43 »
    I have write the tutorial to explain how to do that, and as you have discover, some expertise is needed, but the mechanism is there. So read again, give some time, try and return with your problems

    Jorge

    ..:: Mazhar Hasan ::..

    • Moderator
    • Systems Administrator
    • *****
    • Posts: 828
    • Cheers
      • View Profile
      • SyedMazharHasan.com
    Re: Make screenshots of video to jpg
    « Reply #2 on: 10/14/05, 13:53 »
    As jorge said: Mechanism is there, and thats it, as in your case, you need screen shotsat different positions in your FLV, so here is a little suggestion:

    in jorge's tutorial source files, drag a text input and a button component on stage, name the text input component as "offSet"(without quotes) and name the button component as "seeker"

    and then on first frame of your movie, enter this code:

    var seekObj:Object = new Object();
    seekObj.click = function(){
    	
    _root.output_vid.my_FLVplybk.seekSeconds(Number(_root.offSet.text));
    	
    }
    	

    seeker.addEventListener("click",seekObj);

    Your wish is my command

    curlyfro

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • OTBRadio
    Re: Make screenshots of video to jpg
    « Reply #3 on: 10/14/05, 14:11 »
    ok.  i'm mostly there.  i've got the capture and output working.  but how do i prevent the playback control from buffering the files?  i have ~100 videos.  the buffering can become very expensive to my network.

    ..:: Mazhar Hasan ::..

    • Moderator
    • Systems Administrator
    • *****
    • Posts: 828
    • Cheers
      • View Profile
      • SyedMazharHasan.com
    Re: Make screenshots of video to jpg
    « Reply #4 on: 10/14/05, 14:18 »
    Set the bufferTime = 0
    Your wish is my command

    curlyfro

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • OTBRadio
    Re: Make screenshots of video to jpg
    « Reply #5 on: 10/15/05, 08:29 »
    thank you

    curlyfro

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • OTBRadio
    Re: Make screenshots of video to jpg
    « Reply #6 on: 10/15/05, 15:18 »
    i've got another question...  it'd be cooler if instead of having a jpg thumbnail to have a onMouseOver 5sec video preview.  how would i automate the creation a thumbnail flv from a source flv?

    curlyfro

    • Server what's that
    • *
    • Posts: 6
      • View Profile
      • OTBRadio
    Re: Make screenshots of video to jpg
    « Reply #7 on: 10/17/05, 09:56 »
    i have the video seeking and capturing the video.  but how do i remove the button so that it's automated?

    ..:: Mazhar Hasan ::..

    • Moderator
    • Systems Administrator
    • *****
    • Posts: 828
    • Cheers
      • View Profile
      • SyedMazharHasan.com
    Re: Make screenshots of video to jpg
    « Reply #8 on: 10/17/05, 13:54 »
    if you already know the time offset that where you want the snap shot is to be taken, then add cuepoints there using actionscript explained very well in help docs of flash 8. and when those cue points appears, call the appropiat event for cue point and capture the image.
    Your wish is my command

    Chris

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re: Make screenshots of video to jpg
    « Reply #9 on: 11/06/05, 14:17 »
    Hi guys,

    I also have a question about the snapshot example. Im new to php so I really need some help.

    I was able to run the example on my server. However what I need is to be able to show the jpeg image on the browser (when you click on the "source to jpeg button") and at the same time be able to save that jpeg image on my server. Is that possible?

    I have read some help on php.net and what I did wa I added a filename parameter on the    ImageJPEG function

       ImageJPEG( $image, "image1.jpg");

    It did save the jpeg image on the server but it did not displayed the jpeg image on my browser.

    Please let me know what workarounds I can do or link me to a tuturial that do the same.

    Thanks in advance and more power to flash-db

    -Chris

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Make screenshots of video to jpg
    « Reply #10 on: 11/06/05, 14:29 »
    Didn't test, but something like this:

       //Output image and clean
       ImageJPEG( $image "image1.jpg");
       imagedestroy( $image );   
            $fp = fopen("image1.jpg", 'rb');
       header( "Content-type: image/jpeg" );
            header("Content-Length: " . filesize("image1.jpg"));
            fpassthru($fp);

    Jorge

    Chris

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re: Make screenshots of video to jpg
    « Reply #11 on: 11/06/05, 20:56 »
    Thanks for the reply Jorge, I will test it later and post the result here later.

    Chris

    Chris

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re: Make screenshots of video to jpg
    « Reply #12 on: 11/07/05, 01:29 »
    Vey happy it worked  :) If its not asking too much, I have another problem, I like to display a confirmation text on the show php page. Something like Image has been saved and also a button which I can put an email/Print Script on it. I tried putting an echo "Some text" after the fpassthru($fp); linebut it did not show the text. I was thinking maybe its because the header info. However I also tried removing that but still it did not work.

    Is there a way to put text and button along the generated image?

    Thanks so much
    -Chris

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Make screenshots of video to jpg
    « Reply #13 on: 11/07/05, 04:03 »
    Nop, because you're using a jpg header. If the Filereference onComplete listener fires, you know the file have finished upload, then you can try to load it (or check if it exists using the LoadVars trick) If exists, then you show proper message. The LoadVars trick for knowing if a file exists is:

    chekFile = new LoadVars()
    chekFile.onLoad = function(ok){
      if(ok) trace("exists");
      else trace("doesn't exists");
    }
    chekFile.load("some.jpg")

    Jorge

    Chris

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re: Make screenshots of video to jpg
    « Reply #14 on: 11/08/05, 23:31 »
    Ok will try this work around

    Thanks very much Jorge

    Best,
    Chris