2

I have a one-hour video, that I want to only play sections of it when something triggers it.

from vlc import *
import os

os.add_dll_directory('D:\\VLC')
media_player = MediaPlayer()
media = Media("VID.mp4")
media_player.set_media(media)
media_player.play()

x = 0

if x==1:
   # play the video at 2:34
else:
   # play the video at 3:09
Naz
  • 121
  • 1
  • 8
  • 1
    Does this answer your question? [Start and end at specified timestamps when playing video using python-vlc](https://stackoverflow.com/questions/63234322/start-and-end-at-specified-timestamps-when-playing-video-using-python-vlc) – Gino Mempin Dec 10 '21 at 00:58
  • @GinoMempin - This error appears. Traceback (most recent call last): File "c:\Users\User\Desktop\VLCTestFolder\Code2.py", line 10, in Media.add_option('start-time=120.0') TypeError: add_option() missing 1 required positional argument: 'psz_options' – Naz Dec 10 '21 at 01:05

1 Answers1

0

Media.add_option('start-time=120.0') TypeError: add_option() missing 1 required positional argument: 'psz_options'

This simply means you are applying this to Media where in your code you have defined media = Media("VID.mp4")
So the add_option should be applied to media

Rolf of Saxony
  • 21,661
  • 5
  • 39
  • 60