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

"COM must not be in STA mode\n" #118

Open
Sulisahne opened this issue Jul 15, 2022 · 3 comments
Open

"COM must not be in STA mode\n" #118

Sulisahne opened this issue Jul 15, 2022 · 3 comments

Comments

@Sulisahne
Copy link

Hi

This error occures when calling avcodec_open2 with the AV_CODEC_ID_H265 or AV_CODEC_ID_H264 encoder on windows:

"COM must not be in STA mode\n"
Could not open the codec: "Invalid argument"

Does anyone have an idea how to fix this?

@gizmocuz
Copy link

Did you found the reason or a solution ?

@Sulisahne
Copy link
Author

Calling CoUninitialize(); before avcodec_open2 prevents the error. But that does not seem to be a good solution.

@gizmocuz
Copy link

It seems to only happen when using the default encoder, not when using nvenc or x264
Calling ::CoInitialize(nullptr); or ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) seems to solve this issue

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