【问题标题】:Record video file with 'thumbnail' image in Windows phone 8在 Windows phone 8 中录制带有“缩略图”图像的视频文件
【发布时间】:2013-10-22 17:51:09
【问题描述】:

我正在尝试在 Windows phone 8 中创建一个带有“缩略图”图像的视频捕获应用程序商店视频文件。我从以下链接中得到了一些提示: How to get the thumbnail of a recorded video - windows phone 8?。 但结果很烦人。我觉得这个功能有问题。

 void captureSource_CaptureImageCompleted(object sender, CaptureImageCompletedEventArgs e)
        {
            using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
            {
                WriteableBitmap wb = e.Result;
                string fileName = "CameraMovie.jpg";
                if (isoStore.FileExists(fileName))
                    isoStore.DeleteFile(fileName);
                IsolatedStorageFileStream file = isoStore.CreateFile(fileName);
                Extensions.SaveJpeg(wb, file, wb.PixelWidth, wb.PixelHeight, 0, 85);
                file.Close();

                captureSource.Stop();
                fileSink.CaptureSource = null;
                fileSink.IsolatedStorageFileName = null;
            }
        }

e.Result 中有一些无效数据。当我将它绑定到图像控件时,它会显示一些烦人的图像。 请任何人帮助我。

【问题讨论】:

    标签: windows-phone-8


    【解决方案1】:

    [编辑] 添加一点解释。

    可以在录制视频的任何时候获取正在录制的视频的快照。将预览缓冲区获取为 Argb 像素并将其应用于可写位图。

    当您必须显示视频时,请在屏幕截图图像上添加一个叠加层,并在其上带有一个光滑的播放按钮的另一个图像。

    var videoWritableBitmap = new WriteableBitmap((int)[AudioVideoDevice].PreviewResolution.Width, (int)[AudioVideoDevice].PreviewResolution.Height);
    
    var argbPixels = new int[(int)[AudioVideoDevice].PreviewResolution.Width * (int)[AudioVideoDevice].PreviewResolution.Height];
    
    [AudioVideoDevice].GetPreviewBufferArgb(argbPixels);
    
    argbPixels.CopyTo(videoWritableBitmap.Pixels, 0);
    
    var videoThumbNailFile = await[localFolder].OpenStreamForWriteAsync([ThumbNailImageName], CreationCollisionOption.ReplaceExisting);
    
    videoWritableBitmap.SaveJpeg(videoThumbNailFile, videoWritableBitmap.PixelWidth, videoWritableBitmap.PixelHeight, 0, 100);
    

    【讨论】:

    • 请在您的回答中添加描述
    猜你喜欢
    • 2013-02-22
    • 1970-01-01
    • 1970-01-01
    • 2013-10-29
    • 2013-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-14
    相关资源
    最近更新 更多