NReco Movie

I wrote a function to cut videos using the NReco library.

public void SplitVideo(string SourceFile,string DestinationFile,int StartTime,int EndTime) { var ffMpegConverter = new FFMpegConverter(); ffMpegConverter.ConvertMedia(SourceFile, null, DestinationFile, null, new ConvertSettings() { Seek = StartTime, MaxDuration = (EndTime-StartTime), // chunk duration VideoCodec = "copy", AudioCodec = "copy" }); } 

This works and gives me the video, from the beginning of the video to the maximum duration that I assigned. It does not start from the position of the search value and the maximum duration. Can anyone help me on this.

+2
ffmpeg
Jul 27 '16 at 12:42 on
source share
1 answer

I found the answer to this question. Let it help someone.

I used worong codecs. You should use the correct codec type according to the type of file you are converting. here i am using mp4 file. So I had to use libx264 and mp3. Beelow Code Sample

 public void SplitVideo(string SourceFile,string DestinationFile,int StartTime,int EndTime) { var ffMpegConverter = new FFMpegConverter(); ffMpegConverter.ConvertMedia(SourceFile, null, DestinationFile, null, new ConvertSettings() { Seek = StartTime, MaxDuration = (EndTime-StartTime), // chunk duration VideoCodec = "libx264", AudioCodec = "mp3" }); } 
+2
Jul 29 '16 at 6:44
source share



All Articles