0

I am developing a media player in Qt using libvlc actually I wants to create the thumbnail from the video and I have search all over the internet and found out that i can use libvlc_video_take_snapshot function. Which will take the snapshot of the media but the problem is it opens the player to take the snapshot, I want it to take the snapshot without opening any video player. Here's my code

    inst = libvlc_new (0,vlc_args);

    m = libvlc_media_new_location(inst, "file:///home/vinay/Downloads/sample.webm");
    mp = libvlc_media_player_new_from_media(m);

    libvlc_media_player_play(mp);

When I click a button it will take the snapshot and close the media

void expPlayer::on_pushButton_4_clicked()
{
    //const char *image_path="/home/vinay/Documents/snap.png";
    //int result = libvlc_video_take_snapshot(mp, 0, image_path, 0, 0);

    libvlc_media_player_set_position(mp, VLC_THUMBNAIL_POSITION);
    const char *image_path="/home/vinay/Documents/snap.png";
    int result = libvlc_video_take_snapshot(mp, 0, image_path, 0, 0);

    libvlc_media_player_stop(mp);
}
Vinay Kumar
  • 674
  • 2
  • 9
  • 21
  • 1
    Does this answer your question? [How to take snapshot in libVLC without showing the Media Player](https://stackoverflow.com/questions/57610558/how-to-take-snapshot-in-libvlc-without-showing-the-media-player) – Minh Nov 05 '20 at 07:38
  • No i have already checked that answer but the answer provided there is not working. @NgocMinhNguyen – Vinay Kumar Nov 05 '20 at 13:57

0 Answers0