我用CaptureSource()
來錄製像這個主題How to record video in a camera app for Windows Phone一樣的視頻,但我無法獲得錄製視頻的縮略圖。如何獲取錄製視頻的縮略圖 - Windows Phone 8?
1
A
回答
3
下面是解:
[...]
// Add eventhandlers for captureSource.
captureSource.CaptureFailed += new EventHandler<ExceptionRoutedEventArgs>(OnCaptureFailed);
captureSource.CaptureImageCompleted += captureSource_CaptureImageCompleted;
[...]
captureSource.Start();
captureSource.CaptureImageAsync();
[...]
void captureSource_CaptureImageCompleted(object sender, CaptureImageCompletedEventArgs e)
{
using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
{
System.Windows.Media.Imaging.WriteableBitmap wb = e.Result;
string fileName = "CameraMovie.jpg";
if (isoStore.FileExists(fileName))
isoStore.DeleteFile(fileName);
IsolatedStorageFileStream file = isoStore.CreateFile(fileName);
System.Windows.Media.Imaging.Extensions.SaveJpeg(wb, file, wb.PixelWidth, wb.PixelHeight, 0, 85);
file.Close();
}
}
UPDATE:給用戶的可能性時,他想
在點擊事件的點擊事件viewfinderRectangle
<Rectangle
x:Name="viewfinderRectangle"
[...]
Tap="viewfinderRectangle_Tap" />
呼叫captureSource.CaptureImageAsync();
添加拿縮略圖
private void viewfinderRectangle_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
captureSource.CaptureImageAsync();
}
0
你可以試試這個。如果您使用AudioVideoCaptureDevice api。以下事件在每幀捕獲後調用。您可以選擇任何您需要的框架。作爲第一個。
private AudioVideoCaptureDevice VideoRecordingDevice;
VideoRecordingDevice.PreviewFrameAvailable += previewThumbnail;
bool DisablePreviewFrame = false;
private void previewThumbnail(ICameraCaptureDevice a, object b)
{
if (!DisablePreviewFrame)
{
DisablePreviewFrame = true;
int frameWidth = (int)VideoRecordingDevice.PreviewResolution.Width;
int frameHeight = (int)VideoRecordingDevice.PreviewResolution.Height;
}
int[] buf = new int[frameWidth * frameHeight];
VideoRecordingDevice.GetPreviewBufferArgb(buf);
using (IsolatedStorageFile isoStoreFile = IsolatedStorageFile.GetUserStoreForApplication())
{
var fileName = "temp.jpg";
if (isoStoreFile.FileExists(fileName))
isoStoreFile.DeleteFile(fileName);
using (IsolatedStorageFileStream isostream = isoStoreFile.CreateFile(fileName))
{
WriteableBitmap wb = new WriteableBitmap(frameWidth, frameWidth);
Array.Copy(buf, wb.Pixels, buf.Length);
wb.SaveJpeg(isostream, 120, 120, 0, 60);
isostream.Close();
}
}
}
相關問題
- 1. 如何在Windows Phone 8中獲取視頻文件的視頻縮略圖?
- 2. 在Windows Phone 8中使用「縮略圖」圖像記錄視頻文件8
- 3. 如何獲取視頻縮略圖?
- 4. windows phone 8 - 地圖縮略圖
- 5. 如何在Windows Phone 8上從視頻文件(.mp4)創建縮略圖?
- 6. 如何從視頻ID獲取Facebook視頻縮略圖?
- 7. 如何從服務器視頻獲取視頻縮略圖?
- 8. 試圖獲取視頻縮略圖
- 9. Android視頻錄製和縮略圖
- 10. 獲取網絡視頻的縮略圖
- 11. 獲取縮略圖的視頻快照
- 12. 如何獲得縮略圖視頻
- 13. Bing視頻搜索如何獲取縮略圖並製作視頻預覽?
- 14. 獲取iPhone視頻縮略圖
- 15. 從vimeo獲取視頻縮略圖
- 16. 獲取屏幕視頻縮略圖url
- 17. 從視頻網址獲取視頻的縮略圖圖像
- 18. 如何從MonoTouch獲取現有的視頻縮略圖圖像?
- 19. 在Windows Phone 8中錄製音頻時的可視化
- 20. 獲取的私人視頻的視頻縮略圖在Vimeo
- 21. Windows Phone 8地圖控制 - 如何獲取地圖範圍
- 22. 如何獲得Windows Phone 8的視角?
- 23. 如何從嵌入式視頻獲取縮略圖圖像
- 24. 如何獲取Android的視頻文件的縮略圖
- 25. Windows Phone 8視頻處理庫8
- 26. 如何使用JavaScript獲取html5視頻的縮略圖?
- 27. 如何獲取視頻列表的縮略圖?
- 28. 如何從我的服務器獲取視頻縮略圖?
- 29. 視頻縮略圖
- 30. 如何獲取保存在文檔目錄中的視頻的縮略圖
如何獲取視頻的大小,同時記錄是? – 2013-07-18 06:26:05
我不知道是否有可能在錄製時獲得視頻的大小 – Ouadie 2013-07-18 08:01:57
任何想法如何更改分辨率? http://stackoverflow.com/questions/17715390/how-to-change-the-resolution-of-camera-while-recording-video-in-wp8 – 2013-07-18 08:33:20