Bill Qu
Bill Qu

Reputation: 37

How to get the current video frame while playing video by libvlcsharp?

How to get the current video frame while playing video by libvlcsharp? I can play video with libvlcsharp by the codes below:

public void OnAppearing()
        {


            LibVLC = new LibVLC();
            var media = new LibVLCSharp.Shared.Media(LibVLC, new Uri("http://live.cgtn.com/1000/prog_index.m3u8"));


            MediaPlayer = new MediaPlayer(LibVLC)
            {
                Media = media
            };

            media.Dispose();

            Play();
        }
private void Play()
        {
            
            if (m_url != string.Empty)
            {
                MediaPlayer.Play(new LibVLCSharp.Shared.Media(LibVLC, new Uri(m_url)));
            }
            
           
        }

Upvotes: 0

Views: 1542

Answers (1)

cube45
cube45

Reputation: 4039

You could use the TakeSnapshot method. However please note:

  • The snapshot will be written to the disk, there's no way to get the frame in memory in VLC 3 (A new API for that will likely come in VLC4)
  • This is not meant to grab every frame, use it only for a snapshot.

If you need more frames, have a look at the Thumbnailer samples. They're not meant to grab all frames either.

Upvotes: 0

Related Questions