Apache Video Thumb Extractor is a module for Apache2 to extract an image from a video in a specific second, you also can resizing/cropping it to a given size and extract a storyboard(multiple video frames on sprite) from video.
Requirements
This module depends from some libraries (headers and shared objects) which has to be installed before it: To install FFmpeg from source with the specified versions follow the steps bellow:
git clone git://git.videolan.org/ffmpeg
cd ffmpeg
git checkout n0.8.7 -b tag_n0.8.7
./configure --prefix=/usr --disable-ffserver --disable-ffplay --enable-shared
make
make install
Requirements
All of these libraries was commonly distributed with "FFmpeg":http://ffmpeg.org or in "LIBAV"
LIBRARY | VERSION |
avformat | >= 53.4.0 |
avcodec | >= 53.7.0 |
avutil | >= 51.9.1 |
swscale | >= 2.0.0 |
libjpeg | * |
How to compile
You can run the tests, and see video.jpg and storyboard.jpg saved file from demo video
make test
To compile and install this module on your apache run the command bellow, this action will create a video_thumbnail.so file and put this your Apache module folder. Please check defines.mk file to set your path for installation. Use this till I create a easy way to install like using autotools *
make install
Apache configuration
To enable this module after installation edit httpd.conf file and in module section add
LoadModule videothumb_module [module_path]/mod_videothumb.so
[module_path] => Apache Directory modules in your architecture *
- VideoThumb_Enabled true => Enable videothumb module
- VideoThumb_MediasPath /www/my_videos/ => Path for videos in your filesystem
- VideoThumb_AppPath /thumbnails/ => Path for which you want the module to respond (the URI path)
- VideoThumb_JpegQuality 90 => Jpeg compress quality
How to use
After enable this module you can access using these urls This module can receive four parameters:
- second => Second of video (this module get the nearest keyframe to second) (Optional parameter in storyboard)
- width => Optional parameter to resize width video frame
- height => Optional parameter to resize height video frame
- split => Optional parameter to create a storyboard if you define split=10 this module will return 10 frames from the beginner until the end of video
- columns => Optional parameter to use with split parameter to define how many columns your storyboard must have
- currentPage => Optional parameter to define the current page of storyboard
pageSize => Optional parameter to define how many frame one storyboard page must have
If you don't use width or height parameters, the frame dimension will be equal to the video*
If you use split parameter you can't use second parameter, this function return a sprite with frames in a jpeg file*
Extract an unique video frame:
http://your_host.org/thumbnails/bigbunny.ogg?second=30
http://your_host.org/thumbnails/bigbunny.ogg?second=30&width=640
http://your_host.org/thumbnails/bigbunny.ogg?second=30&width=640&height=360
Extract a storyboard frames(with(out) pagination):
http://your_host.org/thumbnails/bigbunny.ogg?height=100&split=30
http://your_host.org/thumbnails/bigbunny.ogg?height=100&split=30&columns=3
http://your_host.org/thumbnails/bigbunny.ogg?height=100&split=30&columns=3¤tPage=1&pageSize=9