How to cut Video with same Quality, Width and Height?

Topics: Developer Forum
Aug 19, 2012 at 6:19 AM

I have a video, Width = 1280, Height = 720

Once I set VideoWidth = 1280 and VideoHeight = 720 and cut from 12 to 20's.

The applicaion will be crashed.

If I set VideoWidth = 1270 and VideoHeight = 710 and cut from 12 to 20's.

It works without error.

Why I cannot cut the movie with same Width and Height? Any Solution for this case?

Or Any example to cut video (same width, height, same quality)?

Thanks a  lot.

Here's the code:

using (ITimeline timeline = new DefaultTimeline())
{

                    IGroup videoGroup = timeline.AddVideoGroup(VideoBitCount, VideoWidth, VideoHeight);

 ITrack videoTrack = videoGroup.AddTrack();

                    IClip videoClip =
                        videoTrack.AddClip(strInputFile, GroupMediaType.Video, InsertPosition.Absolute, 0, 12, 20);


                    IGroup audioGroup = timeline.AddAudioGroup();
                    ITrack audioTrack = audioGroup.AddTrack();
                    audioTrack.AddClip(strInputFile, GroupMediaType.Audio, InsertPosition.Absolute, 0, dblSecond, dblSecond + 1);

    DirectShowLib.IBaseFilter videoCompressor = GetVideoCompressor("MPEG-4");
                    DirectShowLib.IBaseFilter audioCompressor = GetAudioCompressor("MPEG");
                    using (AviFileRenderer renderer = new AviFileRenderer(timeline, strTempOutputFile, videoCompressor, audioCompressor, null, null))
                    {
                        renderer.Render();
                    }                                   

}