R.Campbell R.Campbell - 1 month ago 17
Python Question

Command works in CMD but not Subprocess

I have created a VLC command that converts an opus file to mp3. This command works in windows CMD but does not work in a subprocess in Python 3.5. I have tried various configuration of the command but with no success, there is no error message I am just greeted with a VLC dummy command line window with no process.
This is the command.

p = subprocess.Popen(["C:/Program Files (x86)/VideoLAN/VLC/vlc.exe", "-I dummy -vvv "E:\\some_dir\\a.opus" --sout=#transcode{acodec=mpga,ab=192}:standard{access=file,dst="E:\\some_dir\\a.mp3"])


I can provide any information required. All input would be greatly appreciated.

Answer

Every argument of the command has to be its own element of the list:

p = subprocess.Popen(["C:/Program Files (x86)/VideoLAN/VLC/vlc.exe",
                      "-I", "dummy", "-vvv",
                      "E:\\some_dir\\a.opus",
                      "--",
                      "sout=#transcode{acodec=mpga,ab=192}:standard{access=file,dst=E:\\some_dir\\a.mp3"
                     ])