使用ResampleMedia重新采样并重置分辨率.docxVIP

  • 4
  • 0
  • 约1.7千字
  • 约 3页
  • 2017-07-28 发布于浙江
  • 举报

使用ResampleMedia重新采样并重置分辨率.docx

使用ResampleMedia重新采样并重置分辨率

【e800编译】此示例演示在Microsoft PowerPoint 2010演示文稿中如何重新取样以及重新设置视频的分辨率。此代码段是Office 2010的101项VBA代码示例中的一部分。与其它示例一样,这些将可以直接写入您的代码中。每块示例代码包含约5至50行的代码,分别演示了一个独特的功能或功能集,在VBA或VB以及C#中(在Visual Studio 2010中创建)。每个示例之中都会包含代码以及相应注释,这样您就可以直接运行获取预期的结果,或者是根据代码注释提示来调整环境,运行示例代码。Microsoft Office 2010提供了你所需要的工具来创建功能强大的应用程序。Microsoft Visual Basic Application(VBA)代码示例可以帮助你创建自己的应用程序,以执行特定功能或者以此为出发点实现更为复杂的功能。实例代码将此代码复制到在新演示文稿的一个模块。在第一张幻灯片里添加视频(在“插入”选项卡中选择“视频”,找到视频目录)。播放视频,确保一切正常,然后将光标放置在下面进程中,单步执行代码。SubResampleDemo() This code works through every shape on the first slide in the presentation, and for each video it finds, resamples the video to 240x320. If the resampling succeeds, the code resizes the video shape to match the new resolution.DimshpAsShapeForEachshpInActivePresentation.Slides(1).Shapes Is it a media shape?Ifshp.Type=msoMediaThenDebug.PrintMedia Element: shp.NameDimnewWidthAsIntegerDimnewHeightAsIntegernewHeight=240newWidth=320 You can specify other parameters, as well, indicating the video frame rate, the audio sampling rate, and the video bit rate. For now, just resample and reset the resolution--the lower the resolution, the smaller the video content.shp.MediaFormat.ResampleTrue,newHeight,newWidthDoDoEventsPause1Debug.PrintResample status: shp.MediaFormat.ResamplingStatusLoopWhileshp.MediaFormat.ResamplingStatus=ppMediaTaskStatusInProgressDebug.PrintResample status: shp.MediaFormat.ResamplingStatusIfshp.MediaFormat.ResamplingStatus=ppMediaTaskStatusDoneThenshp.Width=newWidthshp.Height=newHeightEndIfEndIfNextshpEndSubFunctionPause(numberOfSecondsAsVariant)DimstartTime,endTimeAsVariantstartTime=TimerendTime=startTime+numberOfSecondsDoWhileTimerendTimeDoEventsLoopEndFunction

文档评论(0)

1亿VIP精品文档

相关文档