Ankit Kumar
Ankit Kumar

Reputation: 117

Play video in VLC using python

I am using windows 10 64-bit system. I want to play a video in vlc media player using python2.7. I have implemented this code: import subprocess import os

p = subprocess.Popen(["C:/Program Files/VideoLAN/VLC/vlc.exe","F:/abacus.mp4"])

But on executing the above code, only vlc player get started but does not play that abacus.mp4 video. I have also tried this:

p = subprocess.Popen([os.path.join("C:/", "Program   Files", "VideoLAN", "VLC", "vlc.exe"),os.path.join("F:/", "abacus.mp4")])

But unfortunately, I am getting the same result. Please let me know if anyone could help me on this. Thanks in advance.

Upvotes: 0

Views: 5577

Answers (3)

Roland
Roland

Reputation: 35

This worked for me (for a different but related case):

p = subprocess.Popen(["C:/ProgramFiles/VideoLAN/VLC/vlc.exe","file:///F:/abacus.mp4])

Hope it helps.

Upvotes: 0

Boudhayan Dev
Boudhayan Dev

Reputation: 1

Edit your code as follows :-

p = subprocess.Popen(["C:\\\Program   Files\\\VideoLAN\\\VLC\\\vlc.exe","F:\\\abacus.mp4"])

Upvotes: 0

Graviton
Graviton

Reputation: 123

Why don't you simply use os module and use its popen?

This works for me:

    import os
    os.popen("C:/Program Files/VideoLAN/VLC/vlc.exe F:/abacus.mp4")

Upvotes: 1

Related Questions