Take a single-frame snapshot of a live stream for thumbnail creation (ModuleCreateSnapshot)

This module creates a single-frame FLV file as a snapshot of a stream that can be processed later (with a tool such as FFmpeg) to create a thumbnail image for use on a webpage or playlist. The module's methods for creating the snapshots can be called from a custom Flash client.

A compiled version of this module is included in the Wowza Module Collection.

Configuration


To enable this module, add the following module definition to your application. See Configure modules for details.

Name
Description
Fully Qualified Class Name
createSnapshot Create FLV Snapshot. com.wowza.wms.plugin.collection.module.ModuleCreateSnapshot

Flash client configuration


The module has two methods that can be called from Flash clients to create a snapshot for either live or VOD streams.

Live
For live streams, you can take a snapshot of the current live keyframe.

var resultObj:Object = new Object();
resultObj.onResult = function(fileName: String)
{
	trace("result: "+fileName);
}
nc.call("createSnapshotLive", resultObj, "myStream");

VOD
For VOD streams, you can define the timecode of the point in the video where you want to take the snapshot. The timecode is in milliseconds and the snapshot will be of the closest keyframe to that point.

var resultObj:Object = new Object();
resultObj.onResult = function(fileName:String)
{
	trace("result: "+fileName);
}
nc.call("createSnapshotVOD", resultObj, "sample.mp4", 30000); // 30 seconds into the video
Note: Even though this example uses sample.mp4 as the stream name from which to take the snapshot, the format of the created file will still be FLV. The name of the saved file in this example would be sample.mp4_30000.flv.

The FLV files will be stored in the application's content folder. They can be downloaded from this location and further processed by using FFmpeg or a similar tool.

Post-processing with FFmpeg


FFmpeg can be used to turn the .flv thumbnail into a PNG thumbnail.

ffmpeg -i myStream.flv -vcodec png -vframes 1 -an -f rawvideo -s 320x240 myStream.png
Note: FFmpeg command-line options  may change. Visit http://www.ffmpeg.org/ for current command-line options.