python-vlc
python-vlc copied to clipboard
Extract frames from player
I am trying to get the frames from a URL, How will I be able to achieve this? This is my code.
Instance = vlc.Instance()
player = Instance.media_player_new()
Media = Instance.media_new(playurl)
Media.get_mrl()
Media.add_option('start-time=' + str(round(duration[0])))
player.set_media(Media)
player.play()
time.sleep(duration[1] - duration[0])
player.stop()
FWIW, after (1) commenting out the line Media.get_mrl()
, (2) using a video file name for playurl
and (3) setting duration[0]
to about half the length of the video in seconds, the video start halfway. Tested with tkvlc.py
, VLC 3.0.8 and Python 3.8.2 on macOS 10.13.6.
Perhaps, the vlc.py
method player.video_take_snapshot can get the frames you're lookin for. Closed issue #66 may be helpful too.