[英]Creating Video from generated bitmap images c#
我正在嘗試使用openCVSharp播放位圖圖像流以從YUV生成位圖。 但是我無法將其顯示為視頻。
我發現用它作為一個AVI封裝關於一些鏈接在這里和一些保存在硬盤上一樣在這里和FFMPEG可能工作在Linux上很大,但它不是在Windows中那么好。
我什至嘗試使用以下代碼。 但是它僅顯示序列中的最后一幀,並且我沒有使用MediaElement的URI,因為位圖是由我的程序生成的。
image.source = ToBitmapSource(bitmapImage);
哪里
public static BitmapSource ToBitmapSource(System.Drawing.Bitmap bitmap){
IntPtr ip = bitmap.GetHbitmap();
BitmapSource bs = null;
bs = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ip,
IntPtr.Zero, System.Windows.Int32Rect.Empty,
System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
return bs;
}
我試圖播放視頻(類似於流媒體)而不將其保存在計算機上。 為此必須直接表演嗎? 我迫切需要您的幫助,我的截止日期快到了!
您可以使用DispatcherTimer (等同於Winform中的Timer):
DispatcherTimer dt = new DispatcherTimer();
dt.Interval = 25; //25 ms --> 50 frames per second
dt.Tick += delegate(object sender, EventArgs e){
//get the image and display it
}
dt.Start(); //to start record
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.