点击按钮,我试图在两次特定时间内使用FFmpeg C#Wrapper减少MP4视频。我的代码如下:
private void button1_Click(object sender, EventArgs e)
{
CAVConverter converter = new CAVConverter();
converter.LogPath = @"C:\Users\Rachel\Desktop\Log.txt";
converter.InputOptions.TimeStart = 5000000; //Start time to trim, unit is um(micro second)
converter.OutputOptions.TimeLength = 3000000; //Time length to trim, unit is um(micro second)
converter.AddTask(@"C:\\Users\\Rachel\\Desktop\\Tennis\\Serve.mp4",
@"C:\\Users\\Rachel\\Desktop\\Tennis\\ServeCut.mp4");
converter.StartAndWait();
}
代码编译并运行,但Log.txt文件返回以下内容:
Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 90000.00 (180000/2)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\\Users\\Rachel\\Desktop\\Tennis\\Serve.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
Duration: 00:00:38.76, start: 0.000000, bitrate: 10193 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 1280x720, 9982 kb/s, PAR 65536:65536 DAR 16:9, 30 fps, 90k tbr, 90k tbn, 180k tbc
Stream #0.1(eng): Audio: libfaad, 48000 Hz, 2 channels, s16, 128 kb/s
[mpeg4 @ 09762200]removing common factors from framerate
[mpeg4 @ 09762200]timebase not supported by mpeg 4 standard
Output #0, mp4, to 'C:\\Users\\Rachel\\Desktop\\Tennis\\ServeCut.mp4':
Stream #0.0(eng): Video: mpeg4, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 90k tbc
Stream #0.1(eng): Audio: libfaac, 48000 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0 (Video)
Stream #0.1 -> #0.1 (Audio)
Error while opening encoder for output stream #0.0 (Video) - maybe incorrect parameters such as bit_rate, rate, width or height
Error while opening encoder for output stream #0.0 (Video) - maybe incorrect parameters such as bit_rate, rate, width or height
我对FFmpeg或视频了解不多,所以有人可以帮助我吗? 非常感谢
答案 0 :(得分:0)
您可以使用此类命令
System.Diagnostics.Process.Start(string fileName, string arguments);
或者您可以使用ffmpeg官方网站上的exe并将参数传递给他们。