Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to take snapshot using libvlc_video_take_snapshot without opening media player

How to take snapshot using libvlc_video_take_snapshot without opening media player

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 616 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    devillIsHeree
    wrote on last edited by
    #1

    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);
    }
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Wouldn't it be better to as the vlc devs on how to do so? I don't see where Qt can help you / can do anything against this behavior of libvlc...

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved