The Apache Video Thumb Extractor Module is designed to extract an image from a video at a specific second, allowing for resizing, cropping, and extracting a storyboard (multiple video frames on a sprite) from the video.
https://your_host/thumbnails/bigbunny.ogg?height=100&split=30
https://your_host/thumbnails/bigbunny.ogg?height=100&split=30&columns=5
https://your_host/thumbnails/bigbunny.ogg?height=100&split=30&columns=5¤tPage=1&pageSize=10
https://your_host/thumbnails/bigbunny.ogg?second=30
https://your_host/thumbnails/bigbunny.ogg?second=30&width=640
https://your_host/thumbnails/bigbunny.ogg?second=30&width=640&height=360
This module depends on certain libraries (headers and shared objects) that need to be installed beforehand. To install FFmpeg from source with specific versions, follow these steps:
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
The following libraries are commonly distributed with FFmpeg or in LIBAV:
- avformat >= 53.4.0
- avcodec >= 53.7.0
- avutil >= 51.9.1
- swscale >= 2.0.0
- libjpeg - libjpeg
You can run tests and see the saved files video.jpg and storyboard.jpg from the demo video:
make test
To compile and install this module on your Apache server, run the following command. This action will create a video_thumbnail.so
file and place it in your Apache module folder. Please check the defines.mk
file to set your installation path.
sudo make install
After installation, to enable this module, edit the httpd.conf
file and add the following line in the module section:
LoadModule videothumb_module [module_path]/mod_videothumb.so
VideoThumb_Enabled true
: Enable the videothumb moduleVideoThumb_MediasPath /www/my_videos/
: Path for videos in your filesystemVideoThumb_AppPath /thumbnails/
: Path for which you want the module to respond (the URI path)VideoThumb_JpegQuality 90
: JPEG compression quality
After enabling this module, you can access it using the following URLs. This module can receive several parameters:
second
: Second of the video (this module gets the nearest keyframe to the second) (Optional parameter in storyboard)width
: Resize width of the video frame (optional)height
: Resize height of the video frame (optional)split
: Create a storyboard with a specified number of framescolumns
: Define the number of columns in the storyboardcurrentPage
: Define the current page of the storyboardpageSize
: Define the number of frames one storyboard page must have
If you don't use width or height parameters, the frame dimensions will be equal to the video. If you use the split parameter, you can't use the second parameter, as this function returns a sprite with frames in a JPEG file.