【发布时间】:2020-12-03 06:38:25
【问题描述】:
我正在尝试将 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 等格式,则不会引发错误。
【问题讨论】:
-
你输入的文件名有空格,加引号
-
当我创建字符串时我添加了引号,当控制台中的参数时,引号没有被打印。文件名传递为:'''$_savePath/"${item.fileName}"''' 我尝试使用其他没有空格的 ogg 文件,抛出了同样的错误。
标签: ffmpeg android-ffmpeg