Page 1 of 1

Video Thumbnail (remote file)

Posted: 2011-03-27T06:34:03-07:00
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

Re: Video Thumbnail (remote file)

Posted: 2011-03-27T21:46:41-07:00
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.