我正在尝试将 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
option.
关于该选项,ffmpeg 文档 https://ffmpeg.org/ffmpeg.html#Main-options says:
特殊的价值copy
(仅输出)指示流不被重新编码。
您正在禁用编码并建议 ffmpeg 将 vorbis 流视为 mp3 流。
在你的情况下你want将您的输入流编码为不同的输出流。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)