December 23, 2018

DVR JPEG thumbnails in Nimble Streamer

DVR feature set in Nimble Streamer covers the majority of use cases for streams recording and playback, its setup is described in this article.

We've recently introduced MP4 snapshots of DVR stream which you may use directly via URL or certain kind. MP4 output was chosen over JPG images due to resources usage. MP4 frame can be extracted and inserted into MP4 container with relatively small amount of CPU and RAM. Thumbnails are generated as .mp4 files containing a single key frame. This allows inserting thumbnail in any modern browser using <video> element.

When it comes to saving still image snapshots via JPG, it requires frame decoding and encoding into proper format. That's why you'll need Nimble Streamer Live Transcoder to be available at your DVR server.

Install Live Transcoder and enable thumbnails


Nimble Streamer uses decoding and encoding libraries from Nimble Live Transcoder to get the image from the stream and then encode it into JPG.
So to get his feature working, first you need to install Live Transcoder and subscribe for a license. Once you've installed Live Transcoder and registered the purchased license, you can enable this feature in DVR settings.

Go to Nimble Streamer menu and click on Live streams settings. Once you open settings, go to DVR tab to see your DVR settings. To enable JPG thumbnails, open your stream DVR setting, click on Advanced settings and scroll to Generate JPEG thumbnails checkbox.

Enabling JPG thumbnails generation.
Check that box to enable the feature and use Thumbnail width and Thumbnail height edit boxes to specify dimensions of images. If you leave them as 0, Nimble will save full-size images. If you specify exact values, they will be used for every thumbnail. Another option is to specify only one of those dimensions, in this case, the image will have both sides proportional to each other. E.g. if you set up Thumbnail height to 480 with width set to 0, this will produce thumbnails with 480 height and proportional width, whatever it is for the original image.

Once you start recording any stream via DVR with the feature enabled, it will generate a JPG thumbnail for every recorded segment, its length is defined during the DVR setup. A thumbnail will be a key frame picture at the start of the corresponding segment. Notice that thumbnail generation takes time depending on your hardware so for large resolutions it might take a few seconds. However small resolutions on powerful hardware will allow generating it within a split of a second.

Get thumbnails


Now when DVR is working and pictures are generated continuously, you can get them using the followings URLs.

Latest available thumbnail can be obtained using this type of URL:
http://<server>/<app>/<stream>/dvr_thumbnail.jpg
If you'd like to get specific time spot, add Unix epoch time stamp:
http://<server>/<app>/<stream>/dvr_thumbnail_<epoch_time>.jpg
E.g. http://serverip/live/stream/dvr_thumbnail_1542708934.jpg. In this case Nimble Streamer will return a key frame image at the start of the corresponding segment.

Optimization


If you see that your DVR thread is consuming too much resources, you can add working threads by using thumbnail_transmuxer_threads parameter. Read this reference page for more details about Nimble configuration. By default, this parameter's vaule is "1".

You may also find useful the API call for DVR export to MP4.

If you have any questions on this or other features, let us know.

Related documentation


Nimble StreamerLive streaming scenariosDVR feature setDVR setup for Nimble StreamerUsage snapshots, Watch DVR recording and playback in Nimble Streamer video tutorial

No comments:

Post a Comment

If you face any specific issue or want to ask some question to our team,
PLEASE USE OUR HELPDESK

This will give much faster and precise response.
Thank you.

Note: Only a member of this blog may post a comment.