gpt4 book ai didi

android - 使用带有android native c的FFMPEG将视频转换为音频

转载 作者:太空狗 更新时间:2023-10-29 14:17:38 28 4
gpt4 key购买 nike

我已将 FFMPEG 集成到我的应用程序中,我想将视频转换为音频文件,

但我想使用 native 实现,(JNI) 我不想使用 ffmpeg 脚本,

我已经试过了this

最佳答案

您不能将视频转换为音频。但是,您可以提取并仅存储 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。

关于android - 使用带有android native c的FFMPEG将视频转换为音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20393350/

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