Getting a framegrab of the video in a player

Phil Davis revdev at pdslabs.net
Sat May 28 13:49:36 EDT 2016


Hi Tim,

I see you got an answer, and I trust it will work well for you. I'm just 
adding an alternate way to generate key frame images.

One app I support uses a commandline app (ffmpeg) to create movie 
thumbnails. It works great in my situation - it produces the desired 
outcome a good bit faster than the player approach. That can become 
important when you have potentially dozens of movie files from which to 
you need to extract thumbnails as fast as possible.

The handler looks something like this (I excluded the part where I use 
another commandline app, mediainfo, to verify that the new JPG file is 
readable):


private function _ffmpegThumbPath pMovieFilePath
     # Create a temp file containing a full-size JPEG image of a movie's 
key frame.

     -- ffmpeg path
     put myFullPathToFFMPEG() into tFFMPEGPath

     -- temp image filepath
     put tempName() & ".jpg" into tTempImagePath

     -- create temp thumb image file (same rect as movie)
     put ( q(tFFMPEGPath) && "-i" && q(pMovieFilePath) && "-ss 1 
-vframes 1 -f mjpeg" && q(tTempImagePath) ) into tCommand
     put shell(tCommand) into tOutput

     return tTempImagePath -- the full path of the new JPG file
end _ffmpegThumbPath


function q pString -- thanks to Ken Ray for this
     return quote & pString & quote
end q


HTH -
Phil Davis



On 5/28/16 5:46 AM, Tim Selander wrote:
> Hi,
>
> Once upon a time I am almost positive that I could grab a screenshot 
> of the current video frame in a player, and paste it into a scrolling 
> field.
>
> But I've forgotten how, and no scouring of the dictionary or google 
> help. Can anyone tell me how it's done?
>
> many thanks.
>
> Tim Selander
> Tokyo, Japan
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

-- 
Phil Davis




More information about the use-livecode mailing list