DVR-Scan
DVR-Scan copied to clipboard
Use PyAV for encoding motion events, switch to .mp4 instead of .avi
Using ffmpeg instead of the OpenCV VideoWriter will be faster (allows GPU-based encoding), provide significantly higher quality (or even skip re-encoding entirely by using stream copying), and resolve various issues, e.g. with frame skipping. It also exposes some interesting possibilities for parallelism, since now the video encoding can happen in a separate thread/process.
Also need to add template parameter for video output name format, since right now it's hard-coded (e.g. video-DSME-000
).
Will resolve #27.
This will also fix a bug @ocram found due to using --frame-skip
where the resulting clips appear to be sped up, mentioned in #70. Once videos are exported with ffmpeg, using frame skip will no longer affect the output videos (they will have the same number of frames and playback speed as the original source material).
v1.5 will support using ffmpeg
to extract events, which resolves the frame skip issue, but still doesn't allow using overlays (e.g. timecodes / bounding boxes). Will revisit this for v1.6, as there's other ways this can be addressed as well:
- Using PyAV as per the original issue description
- Using MoviePy
- Writing ffmpeg filters out to disk and invoking ffmpeg directly