gpt4 book ai didi

ffmpeg - 无法将 .ogg 文件转换为 .mp3 或其他文件格式

转载 作者:行者123 更新时间:2023-12-04 22:52:14 27 4
gpt4 key购买 nike

我正在尝试将 ogg 音频文件转换为 mp3 或其他可以在 ios 设备中播放的音频文件格式,但 ogg 文件没有被转换为其他格式,如 mp3 和 caf。我正在 Android 设备中测试转换。

这是我的 ffmpeg 命令参数:

Command: "ffmpeg -y -i $inputFilePath -c:a copy $outputFilePath"
Both input and output filenames were surrounded with quotations

[-y, -i, /data/user/0/com.musicapp/files/composer_audios/testtt ogg file.ogg, -c:a, copy, /storage/emulated/0/Android/data/com.musicapp/files/ball.mp3]

当我尝试转换为 mp3 时。抛出此错误:

 FFmpeg exited with rc: 1
[mp3 @ 0x73f7b36a00] Invalid audio stream. Exactly one MP3 audio stream is required.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

当我尝试转换为 .caf 文件时,会抛出此错误:


FFmpeg exited with rc: 1
[caf @ 0x73f7b36a00] unsupported codec
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input

但是如果我尝试将 mp3 文件转换为 caf、mkv、mp4 等格式,则不会引发错误。

最佳答案

删除-c:a copy选项。

关于该选项,the ffmpeg documentation说:

a special value copy (output only) to indicate that the stream is not to be re-encoded.

您正在禁用编码并建议 ffmpeg 将 vorbis 流视为 mp3 流。

在您的情况下,您想要将输入流编码为不同的输出流。

关于ffmpeg - 无法将 .ogg 文件转换为 .mp3 或其他文件格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63394725/

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