我想为 raw(LINEAR16,48000khz)
填写 ffmpeg.formatCtx使用 avformat_open_input()
的音频文件.
我试图通过自己的AVInputFormat
,但没有成功。
这就是我以前打开文件的方式。
std::string fn = "file:" + this->file.path;
int r = avformat_open_input(&ffmpeg.formatCtx, fn.c_str(), nullptr, nullptr);
尝试使用
av_find_input_format(
找到所需的格式),但没有成功到 0。没有输入格式 ffmpeg 将文件确定为
mp3
.有没有方便的方法来做这种情况?
最佳答案
在 avformat_open_input 中完成的主要事情是:
因为你只有原始音频数据,所以需要为 AVFormatContext 分配内存并自己填充 AVFormatContext。
否则,原始音频数据不需要解复用和解码,我认为你不应该使用 avformat_open_input。
关于c++ - 使用 avformat_open_input 打开原始音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58709378/