This Ruby script will generate preview images and clips for video files using the ffmpeg
utility. By default it will generate a 5x6 grid of images from every 1 second of video, with each image being 120px tall. For example:
You can also configure commands to run against these files in a YAML file to post process them. The default implementation includes commands for transcoding for Web, iPhone, Roku, and also deleting the file.
To use this you'll need to install the following:
ffmpeg
- JSON Ruby Gem
- YAML Ruby Gem
- RestClient Ruby Gem
- My MediaInfo Ruby Gem
- Digest Ruby Gem
- Syslog/Logger Ruby Gem
First, create the file video_preview_config.yaml
using video_preview_config.example.yaml
as an example and configure it for your environment.
Next, call the script and pass the video file as the first parameter. For example
$ mattermost-video-preview.rb preview video_file.mp4
This will post a message to the specified channel with the preview image, some file information, and buttons to activate the configured commands.
Here's a video walkthrough of how it works
- 0.1.0 - Now includes actions!
- 0.0.2 - Now automatically sets interval based on video length. Sends useful output to Mattermost including filename, duration, file size, and format
- 0.0.1 - Initial release