openzim / python-scraperlib

Collection of Python code to re-use across Python-based scrapers
GNU General Public License v3.0
19 stars 16 forks source link

Do not modify the `ffmpeg_args` in `reencode` function #144

Closed benoit74 closed 7 months ago

benoit74 commented 7 months ago

Since 3.3.0, the reencode function (or more exactly the private _build_ffmpeg_args function) is auto-magically adding the -threads argument to the passed ffmpeg_args: https://github.com/openzim/python-scraperlib/blob/453afc03fbffd073188913a9c49871c1736a582b/src/zimscraperlib/video/encoding.py#L22-L26

This causes issues like https://github.com/openzim/kolibri/issues/89 where since we are retrying to encode the video multiple times, the same dictionary is modified twice.

I think that reencode function should not modify the passed dictionary but its own copy.

I add this to the 3.4.0 for now, but clearly deserve a 3.3.1 patch I think.

WDYT?