【问题标题】:FFmpeg extract frames from videoFFmpeg 从视频中提取帧
【发布时间】:2018-05-21 15:04:18
【问题描述】:

我目前正在使用lib 在 Android 中使用 FFmpeg。我试图从视频中每秒提取 1 帧。我当前的命令是:

final String cmd[] = {"-i" + videoPath +  "-vf fps=1" +  mediaStorageDir.getAbsolutePath() + "a.png"};

现在我明白如果这段代码是正确的,图像会不断重叠,因为每个图像都被称为 a.png。现在这不是问题,这段代码用于测试,但我什至无法让命令工作。

这是错误

拆分参数列表时出错:找不到选项

非常感谢任何帮助。 P.S 我用this documentation 找到命令

【问题讨论】:

  • 您需要在输出 png 文件名中添加 %d 并注意 str 添加的空格。

标签: android video ffmpeg


【解决方案1】:

使用如下代码

 File dest = new File(dir, filePrefix + "%03d" + fileExtn);


final String cmd[] = {"-i" + videoPath +  "-vf fps=1" +  mediaStorageDir.getAbsolutePath() + dest.getAbsolutePath()};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-03
    • 1970-01-01
    • 2012-04-14
    • 1970-01-01
    • 1970-01-01
    • 2013-10-01
    相关资源
    最近更新 更多