繁体   English   中英

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

[英]Convert video to audio using FFMPEG with android native c

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

但我希望使用本机实现,(JNI)我不想使用ffmpeg脚本,

我已经试过

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM