oaubert / python-vlc

Python vlc bindings
GNU Lesser General Public License v2.1
381 stars 108 forks source link

Linux segfault while taking snapshot from youtube #229

Open nagayev opened 1 year ago

nagayev commented 1 year ago
try:
    import vlc
except:
    print('Error')
    print('Please install python-vlc')
    exit(1)
import time
import numpy as np
from ctypes import *

class MyDisplay(vlc.VideoDisplayCb):
    def __doc__(o,p):
        print("fsdfs")

if __name__ == '__main__':
    url = 'https://www.youtube.com/watch?v=T8r_Gc6Pg6o&t=3227s'
    #url = 'https://www.youtube.com/watch?v=K6orZrwys1k'
    i = vlc.Instance('--no-audio', '-q')
    media = i.media_new(url)
    media_list = i.media_list_new([url])
    print(media_list)
    p = i.media_player_new()
    p.set_media(media)
    lp = i.media_list_player_new()
    lp.set_media_player(p)
    lp.set_media_list(media_list)
    p.play()

    time.sleep(5)
    r = p.video_take_snapshot(0,'/home/marat/Music/rnd.jpg',0,0) 

Console ouput:

libva info: VA-API version 1.16.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_15 libva info: va_openDriver() returns 0 libva info: VA-API version 1.16.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_15 libva info: va_openDriver() returns 0 libva info: VA-API version 1.16.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_15 libva info: va_openDriver() returns 0 libva info: VA-API version 1.16.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_15 libva info: va_openDriver() returns 0 Segfault (core dumped)
oaubert commented 1 year ago

This is not a python-vlc issue, rather a vaapi/libva issue. If you search for "libva info: va_openDriver() returns 0 Segfault (core dumped) " you will find other software having the same issue, with solutions ranging from uninstalling libva to exporting a variable (in https://github.com/OpenKinect/libfreenect2/issues/1159 ). If you manage to find the appropriate remedy for you, please post it in this issue so that other people can benefit from it.