• How to 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.


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

    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.

    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");
    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 may have changed some command-line options. Please refer to http://www.ffmpeg.org/ for details about the current command-line options.

    Wowza media server software and all components, including modules, source code, and other related items offered on this page, are copyrighted (c) 2006-2014 by Wowza Media Systems, LLC, all rights reserved, and are licensed pursuant to the Wowza Media Software End User License Agreement.

    Originally Published: 02-09-2011.
    Updated: For Wowza Streaming Engine 4.0.6 on 08-11-2014.

    If you're having problems or want to discuss this article, post in our forum.