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.51k stars 155 forks source link

[feature request] Scene detection only run. #573

Closed lastrosade closed 2 years ago

lastrosade commented 2 years ago

This would allow me to avoid running scene detection very slowly with a vpy script or to bodge it with incorrect setting to force av1an to crash.

This way I could run scene detection fast with the source file before encoding with a vpy script.

Something along the lines of av1an -i video.mkv -s video.json --sc-only --sc-method=fast

lavalamp3774 commented 2 years ago

It would also be nice if this were multi-threaded. Currently I'm running scene detection on a 4K movie at only 23 fps on a single core. Without --sc-method=fast I get about 12 fps.

redzic commented 2 years ago

@lavalamp3774 There is also the --sc-downscale-height option which can speed up scene detection. Something like --sc-pix-format yuv420p --sc-method fast --sc-downsale-height 720 should be faster for you.

shssoichiro commented 2 years ago

Although it's important/unfortunate to note that at 4k and higher resolutions, scene detection (especially fast mode) becomes increasingly bottlenecked by decoding. The tips above will help, but only by so much, unfortunately.

silverbacknet commented 2 years ago

@redzic This is more for multi resolutions or qualities, particularly for test encodes, I think, or perhaps for pipelining long queues so that there aren't long periods of most cores being idle between encodes while scene detection is running. It can be shoved to a core or two to handle ahead of time while the bulk are encoding the prior video.