master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.4k stars 147 forks source link

Scene detection stuck in memory allocation loop #758

Open woot000 opened 1 year ago

woot000 commented 1 year ago

On some videos, Av1an will continually allocate RAM in a loop and eventually crash due to the system having no more available memory. Tested it against the master branch, but I also had it happen on commit 14875b4b62ce02ed69ce5c25e4716872b996a6ac (maybe the new av-scenechange version is problematic?)

Currently the only workaround is to use --split-method none, which isn't ideal

image

woot000 commented 1 year ago

More info: When the scene detection gets close to finishing, it seems to count more frames than there are in the video, then gets stuck in an infinte memory allocation loop trying to create the scenes files

What it looks like on my end: infmem infmemgr

woot000 commented 1 year ago

Discovered the root cause of the issue: it happens only when using the master branch of FFmpeg. This doesn't occur if FFmpeg 6.0 is being used. Av1an probably shouldn't be responding to an FFmpeg issue by continually allocating memory until it crashes, though...