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.46k stars 151 forks source link

Suggestion: Improve handling of failed VMAF probes #787

Open clidx opened 10 months ago

clidx commented 10 months ago

aomenc still crashes on specific chunks sometimes. The biggest offender I've noticed is VMAF probing when using a fork. The usual way of moving forward from this is to encode the chunk manually and update done.json. I have 2 suggestions: 1) Add a parameter like --probe-fail-quality=XX where a chunk will be encoded with the CRF/CQ of that value, if VMAF probing fails too many times 2) Skip the chunk, continue encoding and error out before merging the chunks. The user manually encodes the chunk and then --resume merges the chunks. If the first suggestion is implemented, this could be the default behaviour if --probe-fail-quality is not specified, or have another switch controlling whether av1an skips the chunk for the time being. I don't know if av1an already does this but it could also compare the total frames of the chunks/output video vs the source to more or less covers user error.

Suggestion 2 could also be implemented for general chunk encoding fails, not just for probe fails.

I also noticed that av1an doesn't update "per_shot_target_quality_cq" in chunks.json. The CRF/CQ target for each chunk is added to the log file but this isn't persistent across different instances of av1an with --resume. It would be useful if chunks.json was updated with the CRF/CQ as well which would help the user manually encode failed chunks where the actual encode of the chunk fails.