Skip to content

Video Thumb Extractor is a module for Apache2 to extract an image from a video in a specific second, you can also resizing/cropping it to a given size and to extract a storyboard(multiple video frames on sprite) from video.

Notifications You must be signed in to change notification settings

dayvson/Apache-Get-Video-Thumbnail

Repository files navigation

Apache Video Thumb Extractor Module

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.

Extract a Storyboard Frames (with or without pagination):

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&currentPage=1&pageSize=10

Sample Storyboard

Extract a single video frame:

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

Sample Frame

Requirements

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

Dependencies

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

How to Compile

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

Configuration

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 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 compression quality

How to Use

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 frames
  • columns: Define the number of columns in the storyboard
  • currentPage: Define the current page of the storyboard
  • pageSize: 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.

About

Video Thumb Extractor is a module for Apache2 to extract an image from a video in a specific second, you can also resizing/cropping it to a given size and to extract a storyboard(multiple video frames on sprite) from video.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published