媒体文件切割? [英] Media file cutting?

查看:63
本文介绍了媒体文件切割?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


              请问任何人请告诉我C#代码,使用Expression Encoder 3新版本从WMV视频中剪切剪辑。我对Class使用感到困惑。我曾尝试使用Encoder 3 gui剪切wmv文件,但每次都是类似的问题。如果我正在剪切一个wmv文件,它永远不会从其原始位置开始,而是从启动时开始大约2秒的额外时间但是结束帧是正确的。我已经捕获了一个缓冲区值为1和Keyframe Interval 1的文件。这个配置在文件剪切文件中是否存在问题。


Plaese帮助解决问题。


 


谢谢。 :-D


Ajitpal Singh

解决方案

不幸的是,这并不像我们那样完全直观喜欢。我写了一篇小博客文章,希望能在SDK中展示你如何做到这一点。 


http://blogs.msdn.com/deanro/archive /2010/04/13/editing-files-with-encoder-v3.aspx


以下是为方便起见的代码。


 



 //创建媒体项并获取指向初始源的指针。 
MediaItem item = new MediaItem(@"c:\ usersrs \ Public \ Videos \Sample Videos \ Wildlife.wmv");
来源source = item.Sources [0];

//更改第一个剪辑,使其不是跨越整个文件
//我只是将该位编码为5到10秒。
source.Clips [0] .StartTime = new TimeSpan(0,0,5);
source.Clips [0] .EndTime = new TimeSpan(0,0,10);

//同时将原始文件中的位添加20到30秒。
TimeSpan secondClipStart = new TimeSpan(0,0,20);
TimeSpan secondClipEnd = new TimeSpan(0,0,30);
source.Clips.Add(new Clip(secondClipStart,secondClipEnd));



希望有所帮助


问候


迪安。


Hello All,

               Could any one please tell me the C# code to cut the clip from a WMV Video using Expression Encoder 3 new version. I'm just bit confused with Class usage. I have tried cutting wmv file using Encoder 3 gui, but their is a similar issue everytime .If i'm cutting a wmv file , it never start from its original position , instead it start with around 2 seconds extra time from the starting but the end frame is correct. I have captured a file with buffer value 1 and Keyframe Interval 1. does this config is giving some problem in file cutting file.

Plaese help in resolving the issue.

 

thanks. :-D


Ajitpal Singh

解决方案

Yes unfortunately this is not as completely intuitive as we'd like. I'd wrote a little blog post to hopefully show how you can do this in the SDK. 

http://blogs.msdn.com/deanro/archive/2010/04/13/editing-files-with-encoder-v3.aspx

Here's the code for convenience.

 

// Create a media item and get a pointer to the inital source.
MediaItem item = new MediaItem(@"c:\users\Public\Videos\Sample Videos\Wildlife.wmv");
Source source = item.Sources[0];

// Change the first clip so that instead of spanning the entire file
// I'm just going to encode the bit from 5 to 10 seconds.
source.Clips[0].StartTime = new TimeSpan(0, 0, 5);
source.Clips[0].EndTime = new TimeSpan(0, 0, 10);

// Also add the bit from 20 to 30 seconds from the original file.
TimeSpan secondClipStart = new TimeSpan(0,0,20);
TimeSpan secondClipEnd = new TimeSpan(0,0,30);
source.Clips.Add(new Clip(secondClipStart, secondClipEnd));

Hope it helps

Regards

Dean.


这篇关于媒体文件切割?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆