c++ - 在 Visual Studio C++ 中调用 ffmpeg.exe

标签 c++ visual-studio-2012 ffmpeg

我只是 C++ 的新手。
我正在尝试在 Visual Studio 2012 的 C++ 项目中使用 FFmpeg,方法是调用其中的 ffmpeg.exe 文件。

这是我到目前为止所尝试的:

//FFMPEG CALLING
char ffmpeg2[BUFSIZ];
strcpy(ffmpeg2,"..\bin\ffmpeg.exe");
strcat(ffmpeg2,"-f s16le -ar 8K -ac -ss");
strcat(ffmpeg2,buffers);    //string hh:mm:ss
strcat(ffmpeg2,"-t");
strcat (ffmpeg2,buffer);    //string hh:mm:ss
strcat(ffmpeg2,"-i ..\\rec.pcm ..\Desktop\newFolder\filename");
if(system(ffmpeg2) !=0) 
{
    ft =fopen("ffmpeg_err.txt","a");
    fprintf( ft,"my command failed...\n" );
    fclose(ft);
}
else
{system(ffmpeg2);}

它不断在文本文件中产生 my 命令失败。
你们有任何关于如何修复它的提示。

最佳答案

您没有添加任何 空格 在调用 strcat 之前或之后,您的最终命令将类似于..\bin\ffmpeg.exe-f s16le -ar 8K -ac -ss<buffers>-i ..\\rec.pcm ..\Desktop\newFolder\filename在 ffmpeg.exe 之后、-ss 之后、-t 之前和 -i 之前添加一个空格,这样你的
最终命令将变为..\bin\ffmpeg.exe-f s16le -ar 8K -ac -ss <buffers> -i ..\\rec.pcm ..\Desktop\newFolder\filename
这应该可以解决您的问题

关于c++ - 在 Visual Studio C++ 中调用 ffmpeg.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31397785/

相关文章:

c++ - 尝试同时编译三个模板 .cpp 文件会导致 "error: redefinition of method"

c++ - cv::Mat 检测 PixelFormat

c++ - 非 MFC ATL 项目 (dll) 产生 MFC 相关错误

ffmpeg - 将音频流式传输到多个 Web 浏览器

android - 使用 FFmpeg 为 Android 编写自定义编解码器

java - 是否有任何将 CAD 转换为 SVG 的库?

c++ - 从深度纹理采样总是结果为 0

c# - 使用 PrimarySearcher 进行单级搜索

visual-studio-2012 - 在 Visual Studio 2012 中安装 Resharper 后如何重新启用 F12 以转到定义

ffmpeg - 使用 ffmpeg 创建高清 1080p 720p 480p 的多个输出