簡體   English   中英

使用 C# 播放視頻中的特定幀

[英]Play specific frames in video using C#

我正在嘗試在 c# 中播放部分視頻(在此示例中,從第 1 幀到第 299 幀)。 我嘗試使用下面的代碼,它適用於單幀但在添加循環后不顯示任何內容。 該代碼不會引發任何錯誤。

        private void button2_Click(object sender, EventArgs e)
        {
            // Open video file
            VideoFileReader reader = new VideoFileReader();
            reader.Open(@"c:\Users\Replay.avi");

            // Read frame no. 1 to 300 and display in picturebox
            for (int j = 1; j < 300; j++)
             {

                Bitmap replay_frame = reader.ReadVideoFrame();
                pictureBox1.Image = replay_frame;
            }
            reader.Close();

        }

上面的代碼有什么問題?

我知道這已經很老了,但我需要同樣的東西並找到了這個。 你所缺少的只是 pictureBox1.Refresh(); 在你的循環里面。 刷新圖片框后,新圖像才會顯示

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM