gpt4 book ai didi

c# - FFmpeg C# 视频转换

转载 作者:行者123 更新时间:2023-12-04 23:29:14 24 4
gpt4 key购买 nike

单击按钮后,我尝试使用 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 或视频不太了解,所以有人可以帮助我吗?
非常感谢

最佳答案

您可以使用这样的命令

System.Diagnostics.Process.Start(string fileName, string arguments);

或者您可以使用 ffmpeg 官方网站上的 exe 并将参数传递给他们。

关于c# - FFmpeg C# 视频转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26088014/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com