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

Migration guide from writing with imageio-ffmpeg to pyav #1006

Open
djhoese opened this issue Jun 12, 2023 · 0 comments
Open

Migration guide from writing with imageio-ffmpeg to pyav #1006

djhoese opened this issue Jun 12, 2023 · 0 comments

Comments

@djhoese
Copy link

djhoese commented Jun 12, 2023

In an effort to migrate to the v3 api I'm also switching to the pyav plugin. I've spent a decent amount of time trying to figure things out since (unless I'm using it wrong), it isn't a complete 1:1 translation from imageio-ffmpeg to pyav due to differences and conveniences in the defaults. For example, with pyav it seems you have to specify a codec. Also, imageio-ffmpeg seemed to have a default filter that scaled non-power-of-2 images to power-of-2 sizes. Lastly, I'm pretty sure I was always able to pass rgba images and have imageio-ffmpeg "just work", but now when I do it I get an error (copying numpy array with 4 bands to a buffer array with 3 bands) since pyav defaults to an input pixel format of "rgb24". I've hardcoded by usage to codec="libx264", set input pixel format to "rgba"`, and a scale filter:

            params["filter_sequence"] = [
                ("scale", "trunc(iw/2)*2:trunc(ih/2)*2"),
            ]

This seems to work, but is there any documentation about these differences that I missed and should have read first? It was pretty hard to find the information about the filters since those are only documented in the pyav plugin API docs. If this type of documentation doesn't exist, should it? Would you accept a PR adding it? What other gotchas could people encounter?

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

No branches or pull requests

2 participants