How to take snapshot in libVLC without showing the Media Player

馋奶兔 提交于 2021-01-28 00:50:30

问题


I am trying to take snapshot from VLC player using libVLC. But whenever I run the following code, a window opens showing the video streaming and I don't want to open the media player window while doing that. I am taking the video input from an IP camera using RTSP link. Is there a way where I can achieve my goal by keeping the media player window hidden?

Here is my code that I've done till now.

    m = libvlc_media_new_location(inst, "IP/camera/rtsp/link");
    mp = libvlc_media_player_new_from_media(m);
    libvlc_media_player_play(mp);
    while (1) {
        Sleep(500);
        const char* image_path = "E:\\frames\\image.jpg";
        int result = libvlc_video_take_snapshot(mp, 0, image_path, 0, 0);
    }

    libvlc_media_player_stop(mp);
    libvlc_media_player_release(mp);
    libvlc_release(inst);

回答1:


Thank for your question. Add

 const char* const vlc_args[] = {
            "--intf", "dummy",                 
           "--vout", "dummy",                 

    };

when creating libvlc new inst and pass it as argument.



来源:https://stackoverflow.com/questions/57610558/how-to-take-snapshot-in-libvlc-without-showing-the-media-player

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!