Skip to content
meteodrenthe.nl

meteodrenthe.nl

a weather station blog

Menu
Menu

Converting weather cam images to video with FFmpeg

Posted on November 1, 2020 by meteodrenthe

As of November 2020, I use a Foscam FI9900P as a weather cam. It is configured to upload an image twice a minute to my server over FTP. The latest image is then made available on https://meteodrenthe.nl/#/weercam.

The static image is fine, but I also want to be able to show a time lapse, a video with all stills stitched together. To achieve this, I decided to use FFmpeg on the Linux command line. In their own words, FFmpeg is a ‘complete, cross-platform solution to record, convert and stream audio and video.’ It has an option to input multiple images and convert them to a slide show in video format.

The required minimal documentation can be found here. The below command will take all images for November 1st (the usage of the wildcards depends, of couse, on the format of the images generated by the ip cam) and yield a video file ‘output.mkv’.

cat * _20201101-*.jpg | ffmpeg -f image2pipe -i - output.mkv

Compression
The resulting file is well over 200 MB’s large. This is a bit much! There are a bunch of compression options. Additionally, the video is bit fast. The clouds are flashing by so fast, there’s no time to appreciate what is going on! The default frame rate is 25. Lowering it will lower the number of frames passing by each second and, as a consequence, result in a longer video.

I’ve reduced the frame rate to 10. Obviously, changing it is optional. Much depends on how many frames the camera is already producing. I could also opt to increase the number of stills to 4 per minute. As for compression, adding a codec for video encoding should reduce the file size. I will use H.265.

cat *_20201101-*.jpg | ffmpeg -framerate 10 -f image2pipe -i - -c:v libx265 output.mkv

The file is now less than 150 MB in size. Still a lot.

Serious reduction of file size comes when passing a specific bit rate. I noticed that the bit rate of the resulting file was close to 5000 kbit/s. When playing around with the value, it turns out 800 is more than enough. That additional option would slash file size by a factor of roughly 6.

The final command looks like this:

cat *_20201101-*.jpg | ffmpeg -framerate 10 -f image2pipe -i - -c:v libx265 -b:v 800k output.mkv

Now the file size is reduced to roughly 25 MB. This is workable, I think. I might even increase the bit rate a bit.

Next up will be triggering command automatically. This will probably be a daily job. Since I already have a Java application responsible for more processes, I think I will keep everything in one place and let Java fire the command. Before I do this, I will need to decide how to host the video files. More on that in a next post.

My personal weather station is located in a small township in the North of the Netherlands.

This blog records updates to my setup, development of components, weather reports and anything related.

Real time data generated by the weather station can be found on meteodrenthe.nl.

Some products and technologies in use:

Davis Vantage Pro 2

Davis AirLink

Davis WeatherLink Live

Barani MeteoShield Pro

Apogee Instruments TS-100

Davis 7714 radiation shield

MetSpec RAD14 radiation shield

Vaisala DRT504

Siap+Micros SMarT CELLino

Wemos D1 Mini microcontrollers

Bosch BMP280/BMP3xx pressure sensors

Sensirion SHT35 temp/hygro sensor

PT100 temperature sensor

10K NTC thermistors

Adafruit breakout boards

ADS1115 analog-to-digital converter

Light intensity sensors

Voltaic Systems solar panels

Foscam FI9900P weather cam

Raspberry Pi Zero W

Custom printed circuit boards

C++ (Arduino code)

Java (server backend)

Angular Framework

Twitter feed is not available at the moment.
©2025 meteodrenthe.nl | Built using WordPress and Responsive Blogily theme by Superb