gpt4 book ai didi

android - 如何在 C 中编写 ffmpeg 命令 shell

转载 作者:太空宇宙 更新时间:2023-11-04 04:48:09 28 4
gpt4 key购买 nike

这可能是我在问一个废话,但我有点菜鸟......我正在尝试在 Android 中编写 native 代码以使用 FFmpeg 更改视频的分辨率。我编译了FFmpeg的库,并在使用NDK后将其正确添加到我的项目中。但是现在我想执行这个 FFmpeg 命令 shell:

ffmpeg -i input.mp4 -s 480x320 output.mp4

我需要使用 JNI 在 C 文件中执行它,但我不知道如何调用命令的等效方法...

我想我遇到的问题与 here 类似

感谢帮助!!

最佳答案

像这样使用

system("ffmpeg -i input.mp4 -s 480x320 output.mp4");

char str[]="ffmpeg -i input.mp4 -s 480x320 output.mp4";
system(str);

信息

int system (const char* command);

执行系统命令。

示例

#include <stdio.h>
#include <string.h>

int main ()
{
char command[50];

strcpy( command, "ls -l" );
system(command);

return(0);
}

关于android - 如何在 C 中编写 ffmpeg 命令 shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18902984/

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