python-vlc icon indicating copy to clipboard operation
python-vlc copied to clipboard

Extract frames from player

Open kesaroid opened this issue 4 years ago • 2 comments

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()

kesaroid avatar May 19 '20 21:05 kesaroid

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.

mrJean1 avatar May 27 '20 18:05 mrJean1

Perhaps, the vlc.py method player.video_take_snapshot can get the frames you're lookin for. Closed issue #66 may be helpful too.

mrJean1 avatar Jul 14 '20 02:07 mrJean1