Question

i've been searching the net for a way to extract the set poster image from a quicktime movie on the backend once a file has been uploaded. is there an effective way to do this? or is there a way to grab a specific frame as a visual? i would imagine a script could comb the file for the specific attribute value pairs and image content, no? Any help in this subject would be greatly appreciated.

Thanks!

Was it helpful?

Solution

If the poster frame is always part of the .mov video, you can begin by extract the exif tag PosterTime. The value of this tag indicates where in the video the poster frame is, by default it is at time 0 (i.e., the first frame). Then you can extract the frame by some program that understands this video format, ffmpeg is a good such program.

As an example, we can use exiftool to extract the value for the tag PosterTime. I manually changed the poster frame of some video I had around, then using exiftool as

exiftool -PosterTime -b somevideo.mov

I get:

0.013333333333333

This means the poster frame can be found at the second ~0.013 (that is, between the second 0 and second 1 if it is not clear). Now we can extract the single frame at that time using ffmpeg:

ffmpeg -ss 00:00:00.013 -i somevideo.mov -frames 1 posterframe.jpg

Now, note that at http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/QuickTime.html you will see there is also a tag called PreviewPICT. This seems to indicate there could be something else to represent the poster frame, but I'm not sure if this tag is actually used for this purpose.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top