我正在尝试在 Android 中使用 Chaquopy 将 3gpp 音频文件转换为 WAV 格式。3gpp文件存储在外部存储器中(下载文件夹和权限被授予读写操作)。我正在使用 Ubuntu 18.04,并且我已经安装了“ffmpeg”库。代码片段单独运行良好,但在集成到 Android 环境时会出现问题。任何帮助/解决方案?有一些类似的问题,但没有得到正确解释/解决方案不起作用。谢谢你。
这是我的 Python 代码 -
def convert(filename):
# Do not need to convert 3gpp into WAV file.
sound = AudioSegment.from_file(filename)
converted_file = filename + ".wav"
sound.export(converted_file, format="wav")
这是我的堆栈跟踪 -
2021-03-03 15:12:36.680 10002-10002/com.example.myapplication W/e.myapplication: type=1400 audit(0.0:1172): avc: granted { execute } for path="/data/data/com.example.myapplication/files/chaquopy/AssetFinder/stdlib-x86/audioop.so" dev="dm-5" ino=207144 scontext=u:r:untrusted_app:s0:c153,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c153,c256,c512,c768 tclass=file app=com.example.myapplication
2021-03-03 15:12:36.730 10002-10002/com.example.myapplication W/python.stderr: /data/user/0/com.example.myapplication/files/chaquopy/AssetFinder/requirements/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
2021-03-03 15:12:36.775 10002-10002/com.example.myapplication W/python.stderr: /data/user/0/com.example.myapplication/files/chaquopy/AssetFinder/requirements/pydub/utils.py:198: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
2021-03-03 15:12:36.809 10002-10002/com.example.myapplication W/System.err: com.chaquo.python.PyException: FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe'
2021-03-03 15:12:36.809 10002-10002/com.example.myapplication W/System.err: at <python>.subprocess._execute_child(subprocess.py:1702)
2021-03-03 15:12:36.809 10002-10002/com.example.myapplication W/System.err: at <python>.subprocess.__init__(subprocess.py:854)
2021-03-03 15:12:36.809 10002-10002/com.example.myapplication W/System.err: at <python>.pydub.utils.mediainfo_json(utils.py:274)
2021-03-03 15:12:36.809 10002-10002/com.example.myapplication W/System.err: at <python>.pydub.audio_segment.from_file(audio_segment.py:685)
2021-03-03 15:12:36.809 10002-10002/com.example.myapplication W/System.err: at <python>.wavConversion.convert(wavConversion.py:32)
2021-03-03 15:12:36.809 10002-10002/com.example.myapplication W/System.err: at <python>.chaquopy_java.call(chaquopy_java.pyx:380)
2021-03-03 15:12:36.809 10002-10002/com.example.myapplication W/System.err: at <python>.chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrowsNative(chaquopy_java.pyx:352)