Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play video file with VLC, then quit VLC

I am working on a simple Python script that is supposed to do something, then play a video file, and then do some more stuff.

I am forced to do this on a Windows XP machine with Python 3.2.3 and VLC to play my video file.

I am currently using this code...

vlc_path = '\\path\\to\\vlc.exe'
video_path = '\\path\\to\\video\\file'
subprocess.call([vlc_path, video_path])

... to open VLC and play the video. It works nicely. However, the script waits for VLC to quit before it goes on. Which is good and I want to keep it that way.

My question is: Is there a way to quit VLC right after the video file has been played?

Thanks a lot for any help!

like image 946
Florian Avatar asked Apr 20 '12 15:04

Florian


People also ask

How do I stop VLC from auto closing?

Click on "Media"on the tool bar at the top of VLC media player. Click on "Quit at the end of playlist" to disable automatic shutdown of VLC player after video ending.

How do I exit VLC from terminal?

Use the top command to find the PID of VLC and then use the kill command. Example PID is 10443, use "kill 10443".


2 Answers

Funnily enough, vlc has a command line option for this:

  --play-and-exit, --no-play-and-exit
                             Play and exit (default disabled)

So, just pass this option to vlc.

like image 64
FatalError Avatar answered Sep 22 '22 17:09

FatalError


Another option would be to pass the dummy item vlc://quit, e.g.:

vlc audio1.mp3 audio2.mp3 vlc://quit

Source: https://wiki.videolan.org/Transcode/#Completely_non-interactive_transcoding

like image 26
Glutanimate Avatar answered Sep 19 '22 17:09

Glutanimate