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

Add 'decoder' parameter to VideoFileClip and ffmpeg_reader - v2 (dev) #2230

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BackrndSource
Copy link

Same as #2229 but for v2 (dev)

Fixed bug:
- When importing a .webm video with alpha channel, transparency are not working.

Solved issue:
- #2008

References:
- https://www.reddit.com/r/ffmpeg/comments/fgpyfb/help_with_webm_with_alpha_channel/

"FFmpeg's native VPx decoders don't decode alpha. You have to use the libvpx decoder to preserve transparency in .webm videos. "

To preserve the alpha channel also needs to set has_mask parameter to True.

Example of use:

VideoFileClip("video.webm", has_mask=True, decoder="libvpx-vp9")

FFmpeg's native VPx decoders don't decode alpha. You have to use the libvpx decoder to preserve transparency in .webm video.
This commit allows the user to specify the the decoder used to decode the video file.

Example of use:

VideoFileClip("video.webm", decoder="libvpx-vp9")
@Zulko
Copy link
Owner

Zulko commented Nov 25, 2024

Do you think that instead of providing a decoder (which is complicated for the user) maybe we could have an internal check and if the video extension is .webm and has_mask=True, then the decoder is auto-set to libvpx-vp9 ? I see two ways of doing this. Either keep the decoder parameter but set a default decoder="auto" and handle that case, or remove the decoder parameter completely and simply add ['-c:v', "libvpx-vp9"] when he video extension is .webm and has_mask=True.

@BackrndSource
Copy link
Author

Great, what you propose seems like the best option. I'll work on it.

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

Successfully merging this pull request may close these issues.

2 participants