Difference between revisions of "Ffmpeg"

From ZoneMinder Wiki
Jump to navigationJump to search
(Added example FFMPEG_OUTPUT_OPTIONS)
Line 1: Line 1:
ffmpeg is a set of video processing tools used by ZoneMinder to generate true video files from the frames captured and saved.  It has always been under heavy development.
ffmpeg is a set of video processing tools used by ZoneMinder to generate video files from the frames captured and saved.  It has always been under heavy development.


Under ffmpeg 0.4.8, the directions in the official ZoneMinder documentation are exactly right - use './configure <extra options>' followed by 'make', 'make install', and 'make installib' - to compile and install the software for use with ZoneMinder.
FFMPEG is used in two fashions in Zoneminder. For exporting videos, an ffmpeg binary is used (vers. 1.30.4) If you examine the source code, you will see zm_ffmpeg.cpp which uses libavcodec, which is library for the functions that the ffmpeg binary provides which you can wrap into a program (such as ZM).
 
Under the snapshots at least as old as 2008-09-25, the installlib make target has been removedInstead, it's done in the configure stage with './configure --enable-shared --enable-swscale --enable-gpl <extra options>'.  Without passing these extra options to configure, ZoneMinder will be unable to find the header files that it needs to compile correctly.
 
I am unsure as to how common this problem is, but my Slackware box came with GNU make 3.80.  You can check your version with 'make -L'.  The recent development snapshots of ffmpeg will choke with this version of make with a 'virtual memory exhausted' error message.  The solution is to update the version of GNU make on your system to at least 3.81.  (This, in my opinion, is a bug in ffmpeg that should be remedied; thankfully, the solution is simple enough.)




Line 15: Line 11:
usually leave this empty
usually leave this empty
=== FFMPEG_OUTPUT_OPTIONS ===
=== FFMPEG_OUTPUT_OPTIONS ===
Here are some possible settings:
To obtain a good quality export x264 based mp4 video file - the following example works...
To obtain a good quality export x264 based mp4 video file - the following example works...
<code>-r 30 -vcodec libx264 -threads 2 -b 2000k -minrate 800k -maxrate 5000k</code>


<code>-r 30 -vcodec libx264 -threads 2 -b 2000k -minrate 800k -maxrate 5000k</code>
If you want as fast as possible h264(with some sacrifice in quality) you can try
<code>-c:v libx264 -preset ultrafast </code>

Revision as of 20:22, 23 December 2018

ffmpeg is a set of video processing tools used by ZoneMinder to generate video files from the frames captured and saved. It has always been under heavy development.

FFMPEG is used in two fashions in Zoneminder. For exporting videos, an ffmpeg binary is used (vers. 1.30.4) If you examine the source code, you will see zm_ffmpeg.cpp which uses libavcodec, which is library for the functions that the ffmpeg binary provides which you can wrap into a program (such as ZM).


FFMPEG Video Export Options

Ffmpeg is used in exporting events to downloadable video files. Exporting video is done using the zmvideo.pl script.

You can control the options that get passed to ffmpeg during the export process using 2 config options found in the Images tab of the options dialog.

FFMPEG_INPUT_OPTIONS

usually leave this empty

FFMPEG_OUTPUT_OPTIONS

Here are some possible settings:

To obtain a good quality export x264 based mp4 video file - the following example works... -r 30 -vcodec libx264 -threads 2 -b 2000k -minrate 800k -maxrate 5000k

If you want as fast as possible h264(with some sacrifice in quality) you can try -c:v libx264 -preset ultrafast