Search code examples
pythonvlc

Python - quit vlc before completing video file


The following call quits the vlc player after completing the video.

subprocess.call([vlc_path, video_path, '--play-and-exit', '--fullscreen'], shell=False)

If I want to quit vlc in 1 hour irrespective of whether video is complete or not, how can I do it ?


Solution

  • One possible solution is to specify --stop-time <seconds>:

    subprocess.call([vlc_path, video_path, '--play-and-exit', 
        '--fullscreen', '--stop-time','3600'], shell=False)
    

    From the long help (vlc -H):

    Playback control:
      --input-repeat <integer [-2147483648 .. 2147483647]> 
                                 Input repetitions
          Number of time the same input will be repeated
      --start-time <float>       Start time
          The stream will start at this position (in seconds).
      --stop-time <float>        Stop time
          The stream will stop at this position (in seconds).
      --run-time <float>         Run time
          The stream will run this duration (in seconds).