2016-07-27 7 views
2

NRecoライブラリを使用してビデオをカットする機能を記述しました。NRecoビデオカット

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" 
       }); 
     } 

これは動作しており、ビデオの先頭から割り当てられた最大時間までのビデオを私に提供します。シーク値の位置から最大継続時間までは開始しません。私はこれを手伝ってくれますか?

答えて

2

この問題の回答が見つかりました。これが誰かを助けてくれるかも。

私はワーロンコーデックを使用していました。変換するファイルタイプに応じて正しいコーデックタイプを使用する必要があります。ここで私はmp4ファイルを使用しています。だから私は libx264とmp3を使用しなければならなかった。 Beelowはサンプルコードです

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" 
       }); 
     } 
+0

*** FFMpegConverter ***を使用している他のサンプルはありますか? –

関連する問題