Remote video and thumbnails - all researched out
Greetings all,
I have been working to get thumbnail images for a site of mine and have made some fairly decent progress. I have been able to create thumbnails of images locally and those hosted on a remote server as I had hoped.
The issue I am having is that I am unable to do the same for Videos. I have successfully installed each of the following along with their dependencies and confirm they are all working locally:
- ffmpeg (and vicariously ffmpeg-PHP and ffmpegthumnailer)
- Imagick (currently working for all simple "image" thumbnail creation, l开发者_Python百科ocal and remote)
- mplayer
As of yet I have been unable to find a method that would allow me to capture a thumbnail from my own video files on a remote server. The reason I am trying to connect to a remote video file is because these videos can range from 5MB to 300MB each and I don't desire to copy the entire movie locally just to create a thumbnail.
I had come across one of these that "may" allow capturing an image from a rtmp stream, which I conveniently do have access to ... but nothing fruitful came of it.
Any ideas would be greatly appreciated,
Thank you,
Silver Tiger
Update from Silver Tiger:
Looks like i had an alternative method via a third party. I used Zendcoder to convert the video files on the fly to a standard format that can play on my web project reliably, and as part of thier service, they will automatically create a dynamic thumbnail and upload it to my Amazon S3 along side the converted Video file.
Crisis averted, but in a roundabout way, and not a solution I could provide as a "solution" to anyone else unfortunately.
If you have ffmpeg installed it should be quite easy. Try something like this
$movie = 'somefile.avi'; // video file $time = '00:03:34'; // time where to take the snapshot $cmd = "ffmpeg -i '{$movie}' -an -ss {$time} -an -r 1 -vframes 1 -y thumb.jpg"; $escCmd = escapeshellcmd($cmd); system($escCmd);
Maybe you could have a script on the remote server to call? This way the thumbnail is generated on the remote server, and then passed back to the front-end server.
The easiest way to do this is to install apache (or whatever you prefer) and host the thumbnail generation scripts on there. Then all you would need to do is call:
$imageData = file_get_contents('http://remotehost/generateThunmb.php?videoid=bleh');
精彩评论