Video Thumbnail (remote file)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Silvertiger
Posts: 2
Joined: 2011-03-27T06:24:27-07:00
Authentication code: 8675308

Video Thumbnail (remote file)

Post by Silvertiger »

I have a system set up whereby my users upload files from their local machines directly to an Amazon AWS S3 repository, meaning that I do not have "local" access on my server of the "original" files to creat thumbnails from. I have been able to create a workaround for making thumbnails of images using the following method:

Code: Select all

		$S3_file_name = "https://s3.amazonaws.com/bucket/filename.jpg";
		$handle = fopen($S3_file_name, 'rb');
		$img = new Imagick();
		$img->readImageFile($handle);
		$img->thumbnailImage( 100, null );
		//$img->roundCorners( 5, 5 ); // Not working yet, I may have something installed wrong
		//$shadow->setImageBackgroundColor( new ImagickPixel( 'black' ) ); // Not working yet, I may have something installed wrong
		//$shadow->shadowImage( 80, 3, 5, 5 ); // Not working yet, I may have something installed wrong
		//$shadow->compositeImage( $img, Imagick::COMPOSITE_OVER, 0, 0 ); // Not working yet, I may have something installed wrong
		$img->writeImage('temp_thumbnails/thumbnail.jpg";
This works very well (minus the extensions i haven't gotten working yet) for still images. The issue is that I also have videos on that server that I need thumbnails of. I am looking for a method to create those thumbnails in the same way. The videos range in size from very small to upwards of 300MB each, so It would be crazy to download each video just to create a thumbnail, hence my search for a hook or method that works.

Any tips would be greatly appreciated.

Thank you,

Silver Tiger
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Video Thumbnail (remote file)

Post by anthony »

ImageMagick itself does not know about video formats. It uses ffmpeg to extract images from the video.

I suggest you use ffmpeg yourself to extract a specific frame from the video. Say at a timecode 1/3 of the way through.
That seems to be a popular thumbnailing point.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply