vlc.py returns ""cannot initialize COM"

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
Coleslaw
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Oct 2018 23:24

vlc.py returns ""cannot initialize COM"

Postby Coleslaw » 19 Oct 2018 23:54

I've written a PyQt4 app that uses VLC. I've primarily developed it on a Linux machine but it's intended for use on Win7-64 host.

When run on Linux, works fine. When run on Win7, the exact same code returns the following error message:

>> plugin path: C:\Program Files\VideoLAN\VLC
>> Warning: option --plugin-path no longer exists.
>> Warning: option --plugin-path no longer exists.
>> [0000000000349ed0] mmdevice audio output error: cannot initialize COM (error 0x80010106)
>> [000000000c0724c0] mmdevice audio output error: cannot initialize COM (error 0x80010106)

On Win7, app launches fine, but when it attempts to load & play a movie in a PyQt4 window the error above is printed.
Again, on Linux, this all works. Movie is played back fine in the PyQ4 window.
It's only on Win7 that this fails. It's not related to PyQt4.

VLC version on Win7 is latest version, 3.0.4. The normal VLC app (vlc.exe) works fine, loads & plays movies fine.
Here's a snippet of the relevant code:

self.instance = vlc.Instance('--no-xlib', '--no-audio', '--mouse-hide-timeout=3')
self.mediaplayer = self.instance.media_player_new()

Just recently added the '--no-audio' flag hoping this might fix the issue but it did not.
Strictly speaking, I don't need to hear the audio really, just need this to play the video,etc.

I've searched the forum here and found two mentions of 'cannot initialize COM' but they don't seem to relate to this issue.
The Win7-64 host does not have an audio card, but uses the onboard sound chip,etc.
All other apps on the computer (Spotify,VLC,RV) produce normal audio output.

Does anyone have any advice about how to resolve this? Are there add'l flags I should add on the 'Instance' line? A Preferences setting?
Thank you very much,
Last edited by Coleslaw on 20 Oct 2018 00:36, edited 1 time in total.

Coleslaw
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Oct 2018 23:24

Re: vlc.py returns ""cannot initialize COM"

Postby Coleslaw » 20 Oct 2018 00:22

Just to clarify further,..

My app imports vlc.py (just simply import vlc)...

That actual error message I believe originates from mmdevice.c

I am not (re-)compiling the original source of VLC,...vlc.py finds & loads libvlc.dll,etc..

Thank you,

Rémi Denis-Courmont
Developer
Developer
Posts: 15227
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc.py returns ""cannot initialize COM"

Postby Rémi Denis-Courmont » 20 Oct 2018 12:18

That error is non fatal. LibVLC will fallback to DirectSound - and it really does not matter if you disable audio.

If you want to resolve it, you probably need to stop initializing the COM STA on the thread(s) calling LibVLC.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Coleslaw
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Oct 2018 23:24

Re: vlc.py returns ""cannot initialize COM"

Postby Coleslaw » 22 Oct 2018 21:29

Hi Remi, Thank you for your reply.

Could you elaborate a bit more on your answer? I don't do a lot of Win-specific programming...
While I do know what 'COM' is generally speaking and encountered it a few times over the years,
I'm not familiar with the term 'COM STA', though I did google it, etc ;-)

Maybe I should be, but I'm not calling/running the vlc instance in a formal separate worker thread. PyQt4 may be doing that behind
the scenes, but I've just wrapped the vlc calls into its own separate python class,etc, and most of that code is culled from qtvlc.py
from the Videolan website. Really not doing anything fancy. Since it runs fine on Linux but not on Win7-64, I just figured it was a
configuration kind-of-issue, but if I'm reading you right, this may be resolved by tweaking my python code around the Instance() or similar initialization calls, yes?

Thank you very much,
Cheers,

Coleslaw
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Oct 2018 23:24

Re: vlc.py returns ""cannot initialize COM"

Postby Coleslaw » 22 Oct 2018 22:27

Hi again,..I'm using a 64-bit build of Python 2.7, I thought there was a 64-bit version of VLC, but now I'm not so sure...

Would ctypes() in the 64-bit Python have issues loading a 32-bit libvlc.ddl ?
Is there a 64-bit build of VLC ?

Thank you,

Coleslaw
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Oct 2018 23:24

Re: vlc.py returns ""cannot initialize COM"

Postby Coleslaw » 22 Oct 2018 23:51

hmm, i think this may be my problem, (run in Cygwin)

> python -i
Python 2.7.7 (default, Jun 1 2014, 14:21:57) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import cdll
>>> lib = cdll.LoadLibrary('libvlc.dll')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\ctypes\__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application

Coleslaw
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Oct 2018 23:24

Re: vlc.py returns ""cannot initialize COM"

Postby Coleslaw » 23 Oct 2018 00:25

Ahh, yes, that was the problem I think..I found a 64 bit build of VLC here:

http://download.videolan.org/pub/videol ... 0.4/win64/

Now, the cdll() load call above works...

Sorry I didn't catch this earlier,...Thank you for your message, Cheers,

Coleslaw
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Oct 2018 23:24

Re: vlc.py returns ""cannot initialize COM"

Postby Coleslaw » 23 Oct 2018 22:20

Hi again Remi, thought you might want to know,
Continued to have difficulty getting 3.0.4 to work with PyQt4,...saw an earlier thread, uninstalled 3.0.4 and installed 2.2.8 (WeatherWax) and now it works.
Thank you,

himura
New Cone
New Cone
Posts: 1
Joined: 26 Oct 2018 10:52

Re: vlc.py returns ""cannot initialize COM"

Postby himura » 26 Oct 2018 10:54

Hi guys, I have the same problem in my python-vlc-enabled app on Windows. I build with the latest toolset. I guess there were some updates that broke something ((

Rémi Denis-Courmont
Developer
Developer
Posts: 15227
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc.py returns ""cannot initialize COM"

Postby Rémi Denis-Courmont » 26 Oct 2018 17:21

Could you elaborate a bit more on your answer?
No, I cannot. I do not know what your program, the VLC Python bindings and the other Python modules do. I can only give you the VLC engine view point, which I did.

If you are not initializing COM yourself, then most likely your interpreter, or a module within the interpreter is doing it (wrong).
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Coleslaw
Blank Cone
Blank Cone
Posts: 12
Joined: 19 Oct 2018 23:24

Re: vlc.py returns ""cannot initialize COM"

Postby Coleslaw » 27 Oct 2018 03:32

Hi Remi, Thank you for your reply.
Apologies if I was vague, but the solution that worked for me didn't require any modification to my code,
I simply installed 64-bit 2.2.8 and now it works,
Thank you again,


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 16 guests