Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoders are not always fully compatible with all image shapes #73

Open
hmaarrfk opened this issue Jul 21, 2022 · 2 comments
Open

Encoders are not always fully compatible with all image shapes #73

hmaarrfk opened this issue Jul 21, 2022 · 2 comments

Comments

@hmaarrfk
Copy link
Contributor

So we ran into this, and I figured I would share back some findings since I did contribute the code in question:

In recent version of imageio-ffmpeg, an attempt is made to find the "best" encoder.

h264_encoder_preference["libx264"] = 100

However, the choice of encoder also needs to be conditioned, among other things, on the encoder capabilities.

Different things, like the pixel type, but most critically, the image shape, can affect the best choice for the given encoder.
See for example the bug report: https://trac.ffmpeg.org/ticket/9251

I've added a shape parameter to the test to ensure that the choice of encoder matches the shape of the video.

You probably also want to test with the compatibility of the filters. Though for me, this is outside the scope of my immediate needs.

@almarklein
Copy link
Member

Thanks for reporting this. From what I understand some encoders may not support videos with a with/height smaller than 145 pixels. Do you know whether the limitations only relate to a minimum size or also e.g. factor of 2 constraints?

@hmaarrfk
Copy link
Contributor Author

I figured that the cost of the test is small compared to the encoding time.

With users likely to encode under the same settings many times, the test, in conjunction with the shape as a tuple and lru cache, should amortize to 0 over the long run.

There i just test every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants