Open isarandi opened 1 week ago
Good point. A PR is very welcome!
The output fps could indeed be fixed, but I think for reading the exact fps, ffprobe is needed (the ffmpeg binary only prints the fps rounded to two decimals), but apparently that dependency is not part of this library, so it can't be done.
Mmm, good point...
https://github.com/imageio/imageio-ffmpeg/blob/0585a7b5fa0ea0628712b319ff898ad6f537b03e/imageio_ffmpeg/_io.py#L528C4-L528C65
Here, the fps gets rounded, which makes it hard to transform an existing video's frames while keeping the source fps in the resulting video (so that it e.g. doesn't lose sync when you add audio to it or subtitles or anything else).
Even the metadata['fps'] is rounded when checking the fps of an existing video since it gets parsed from ffmpeg output header.
My workaround for getting the fps is:
And the workaround for specifying the fps is:
or
But it would be best if imageio handled exact frame rates out of the box without rounding.