答案 0 :(得分:1)
您无法将视频转换为音频。但是,您可以提取并仅存储AVFormatContext的音频子流。伪代码:
// look for the first auid substream, and save its index:
for (size_t i = 0; i < AvFormatContextInstance->nb_streams; ++i)
if (AvFormatContextInstance->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
streamindex = i;
现在您需要做的就是丢弃其他索引上的所有其他流,并从识别的音频流中保存AVPackets。