Flussonic Media Server documentation

Thumbnails

Video is a stream of pictures, but sometimes you need to extract these pictures and handle them separately from each other. This is called thumbnails or screenshots.

Flussonic can make thumbnails of video stream, save them to DVR.

You can:

  • show instant preview of a live stream on web page to know what is happening there right now;
  • take a look at quality of stream;
  • freeze a point in time to use screenshot somewhere else;
  • make a fast DVR search for some fragment of video identifiable by screenshot;
  • create a wall of screenshots to quickly look at whole day of recording;
  • do whatever else you want with static small images extracted from large video stream.

Flussonic gives rather common thing: extraction of video frames as JPEG and new cool feature: video thumbnails.

JPEG thumbnails Anchor Anchor x2

Flussonic can do a rather CPU consumptive job: take first keyframe of each segment, decode it to raw video and encode back to a JPEG image. Looks rather simple, but when you have 300 streams it takes a lot of CPU.

We make some optimizations here that you should take care of. As it was told Flussonic takes only first keyframe of a segment. It means that if you configure segment duration of 3 seconds, you have 20 JPEGs per minute. If you configure it 6 seconds, you have 10 JPEGs per minute.

If you take a stream from IP camera, you may have 60 keyframes per minute, but Flussonic will make smaller amount of JPEG.

When you enable DVR on a stream, all these JPEGs are written on disk.

It is possible to optimize CPU usage by switching to url thumbnails. Usually it is suitable for IP cameras because IP camera maintain fresh JPEG screenshot for currently showed video. In this case Flussonic will download JPEG each time when video segment starts.

JPEGs on CPU Anchor Anchor x2

Flussonic can make JPEG from video through additional packet flussonic-ffmpeg. You need to install it:

apt-get -y install flussonic-ffmpeg
/etc/init.d/flussonic restart

and add thumbnails option to stream settings:

stream ort {
  url udp://239.255.0.100:1234;
  thumbnails;
}

This will start additional process flussonic-thumbnailer and you can watch on server console that it may be rather hungry for resources. Sorry, but this is a nature of video and image compression.

All settings can specify through admin panel in stream's setting in Process tab.

JPEGs from URL Anchor Anchor x2

You can specify URL where Flussonic can get screenshots to reduce CPU usage for thumbnails. Many cameras has special URL with screnshots:

stream cam0 {
  url rtsp://10.0.4.3:554/h264;
  thumbnails url=http://10.0.4.3/cgi-bin/snapshot.cgi
}

You can try to find screenshot URL in documentation for you camera model, but in 99% you do not have this manual, so you will need to look in the internet for this.

Get live preview Anchor Anchor x2

You need to read somehow thumbnails after you enable them in Flussonic.

Url for this is rather simple:

http://flussonic:8080/ort/preview.jpg - stream's last screenshot.

http://flussonic:8080/ort/preview.mjpeg - MJPEG screenshot stream.

We strongly recommend never to use mjpeg because it is an uncontrollable way of streaming video with a very high bitrate. You can get up to 50% of original bitrate for video with 0.1fps. But if you still need it, you can use it.

Get JPEG from DVR Anchor Anchor x2

Screenshots are automatically saves to the archive. They can be obtained via HTTP API, but it is not trivial.

First you need to identify time range for which you want to get DVR. For example right now it is 2017 April 21, 13:10 GMT, it is 1492780200 UTC. If you want to get thumbnails during last hour, you need to request following url:

curl 'http://flussonic:8080/clock/recording_status.json?from=1492776600&duration=3600'

[{"stream":"clock","ranges":[{"duration":3642,"from":1492776599}],"brief_thumbnails":[1492776599,1492776605,
1492776617,1492776629,1492776641,1492776653,1492776665,1492776677,1492776689,1492776701,1492776713,1492776725,
1492776737,1492776749,1492776761,1492776773,1492776785,1492776797,1492776809,1492776821,1492776833,1492776845,
....]}]

Here you get a very long list of timestamps that need to be converted to paths. For example timestamp 1492776605 will be converted to http://flussonic:8080/clock/2017/04/21/12/10/05.jpg.

So first you get a list of thumbnails and then you query them by calculated url.

Ondemand JPEG generation Anchor Anchor x2

Sometimes it is very expensive to store all JPEGs on disk, so you can ask Flussonic to generate JPEG ondemand. Request url http://flussonic:8080/clock/2017/04/21/12/10/05-preview.jpg and Flussonic will take segment, take first keyframe and generate JPEG from it.

This method may lead to unpredictable CPU usage, so it is basically not recommended.

Unpredictable here means that it is really hard to predict. With enabled JPEG thumbnailer you have smooth and moderate CPU usage, but not more. With ondemand JPEG you may have low CPU usage, but during prime time you can get spike and your server may become unstable.

Read more about video thumbnails