【问题标题】:Converting files from a C++ base [closed]从 C++ 基础转换文件 [关闭]
【发布时间】:2014-04-21 23:39:30
【问题描述】:

我正在寻找一种从C++ 的程序中使用 ffmpeg 的方法,只需在其中输入几项内容即可实现超级简单和准确的转换。除了最重要的部分外,我一切正常。实际的转换器。到目前为止,这是我的代码 - 如何在 C++ 中使用 ffmpeg?

#include <iostream>
#include <mp>

using namespace std;

int main()
{
    std::string formatIn;
    std::string FormatOut;
    std::string confirm;
    cout << "select format that file is currently in: mp3, gp3, mp4, flv" << endl;
    cin >> formatIn;
    cout << "original format = " << formatIn << endl;
    cout << "choose your target format: mp3, gp3, mp4, flv" << endl;
    cin >> FormatOut;
    cout << "selected format = " << FormatOut << endl;
    cout << "proceed? ";
    cin >> confirm;
    if(confirm == "yes") {
        cout << "proceeding with operation:" << endl;
        func convert();
    }
    else {
        if(confirm == "no") {
            cout << "canceling,,," << endl;
        }
    }
}

int convert()
{

}

【问题讨论】:

    标签: c++ ffmpeg converter


    【解决方案1】:

    你有两个选择:

    • 调用命令行版本(使用system 调用应该没问题)。构建一个命令行字符串,然后将其传递给system 调用;

    • 链接到 API 并直接从代码中执行。 API 文档在这里:http://ffmpeg.org/documentation.html

    【讨论】:

    • 如何让程序识别 ffmpeg?是自动生成的,还是需要头文件?
    • 如果您从std::system 调用,您只需包含&lt;cstdlib&gt;。然后,只要 ffmpeg 在路径中,您就可以像使用 shell 一样运行它。
    猜你喜欢
    • 1970-01-01
    • 2016-04-07
    • 1970-01-01
    • 2017-01-20
    • 2021-12-25
    • 2012-11-07
    • 2017-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多