FFmpeg is an easy to use comand line tool. It enables you to automatically proccess images and videos recorded by multible surveillance systems.

FFmpeg with Raspberry Pi »

Usefull commands

These commands can be executed by a cronjob or a pyhton script handling differend proccesses like video/image transfomation, storage, maintenance and alerting.


Take all images in the current folder "*.jpg" (in alphabetical order) and create a *.mp4 video (H.264 codec).

 ffmpeg -f image2 -pattern_type glob -i "*.jpg" -r 25 output.mp4
 ffmpeg -f image2 -r 5 -pattern_type glob -i "*.jpg" -r 25 output.mp4 

Extract sound

Extracting sound from a video, and save it as Mp3

 ffmpeg -i video.mp4 -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.mp3 

Create gif

Convert .mp4 to animated gif(uncompressed)

 ffmpeg -i video_origine.mp4 gif_anime.gif 

Convert H.264 to flv

 ffmpeg -i input.mp4 -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv video_finale.flv 

Convert H.264 to MPEG-1

 ffmpeg -i input.mp4 video_finale.mpg 

Convert MPEG-1 to H.264

 ffmpeg -i input.mpg video_finale.mp4 

Add sound

 ffmpeg -i input.mp4 -i sound.mp3 -sameq video_sound.avi