Closed ksk0629 closed 10 months ago
You can use the ipod
format to export to m4a
(see original answer)
Thank you!!! It worked well!
Thank you!!! It worked well!
May I ask how the problem was ultimately resolved
I put ipod
as format.
audio_data.export(output_path, format="ipod")
tks,but The from_file
function does not support the m4a
format
CouldntDecodeError Traceback (most recent call last) Cell In[40], line 10 7 audio_path = "audio/londonbridge-practice-3.m4a" 8 format = os.path.basename(audio_path).split(".")[1] ---> 10 match_target_amplitude(audio_path, format)
Cell In[36], line 5, in match_target_amplitude(audio_path, audio_format, target_dBFS) 3 def match_target_amplitude(audio_path, audio_format, target_dBFS=-20): 4 # sound = AudioSegment.from_mp3(audio_path) ----> 5 sound = AudioSegment.from_file(audio_path) 6 change_in_dBFS = target_dBFS - sound.dBFS 7 normalized_sound = sound.apply_gain(change_in_dBFS)
File /opt/anaconda3/envs/solfeggio_env/lib/python3.10/site-packages/pydub/audio_segment.py:773, in AudioSegment.from_file(cls, file, format, codec, parameters, start_second, duration, **kwargs) 771 if close_file: 772 file.close() --> 773 raise CouldntDecodeError( 774 "Decoding failed. ffmpeg returned error code: {0}\n\nOutput from ffmpeg/avlib:\n\n{1}".format( 775 p.returncode, p_err.decode(errors='ignore') )) 777 p_out = bytearray(p_out) 778 fix_wav_headers(p_out)
CouldntDecodeError: Decoding failed. ffmpeg returned error code: 183
Output from ffmpeg/avlib:
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 12.3.0 (conda-forge gcc 12.3.0-5) configuration: --prefix=/home/conda/feedstock_root/build_artifacts/ffmpeg_1706918361713/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac --cc=/home/conda/feedstock_root/build_artifacts/ffmpeg_1706918361713/_build_env/bin/x86_64-conda-linux-gnu-cc --cxx=/home/conda/feedstock_root/build_artifacts/ffmpeg_1706918361713/_build_env/bin/x86_64-conda-linux-gnu-c++ --nm=/home/conda/feedstock_root/build_artifacts/ffmpeg_1706918361713/_build_env/bin/x86_64-conda-linux-gnu-nm --ar=/home/conda/feedstock_root/build_artifacts/ffmpeg_1706918361713/_build_env/bin/x86_64-conda-linux-gnu-ar --disable-doc --disable-openssl --enable-demuxer=dash --enable-hardcoded-tables --enable-libfreetype --enable-libharfbuzz --enable-libfontconfig --enable-libopenh264 --enable-libdav1d --enable-gnutls --enable-libmp3lame --enable-libvpx --enable-libass --enable-pthreads --enable-vaapi --enable-libopenvino --enable-gpl --enable-libx264 --enable-libx265 --enable-libaom --enable-libsvtav1 --enable-libxml2 --enable-pic --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libopus --pkg-config=/home/conda/feedstock_root/build_artifacts/ffmpeg_1706918361713/_build_env/bin/pkg-config libavutil 58. 29.100 / 58. 29.100 libavcodec 60. 31.102 / 60. 31.102 libavformat 60. 16.100 / 60. 16.100 libavdevice 60. 3.100 / 60. 3.100 libavfilter 9. 12.100 / 9. 12.100 libswscale 7. 5.100 / 7. 5.100 libswresample 4. 12.100 / 4. 12.100 libpostproc 57. 3.100 / 57. 3.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x557992c22bc0] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible! [mov,mp4,m4a,3gp,3g2,mj2 @ 0x557992c22bc0] moov atom not found [in#0 @ 0x557992c22a80] Error opening input: Invalid data found when processing input Error opening input file audio/londonbridge-practice-3.m4a. Error opening input files: Invalid data found when processing input
Requested output format 'm4a' is not a suitable output format
similar error with ffmpeg 6.1.1
$ ffmpeg -y -f wav -i /run/user/1000/tmpt9qeh4tl -f mka /run/user/1000/tmp_fpjg2b6
[AVFormatContext @ 0x1b1dc80] Requested output format 'mka' is not known.
but it works when i remove -f mka
and add the output file extension .mka
$ ffmpeg -y -f wav -i /run/user/1000/tmpt9qeh4tl /run/user/1000/tmp_fpjg2b6.mka
Output #0, matroska, to '/run/user/1000/tmp_fpjg2b6.mka':
Metadata:
encoder : Lavf60.16.100
Stream #0:0: Audio: vorbis (oV[0][0] / 0x566F), 44100 Hz, mono, fltp
Metadata:
encoder : Lavc60.31.102 libvorbis
ffmpeg -muxers
shows no mka
but matroska
, so this works
ffmpeg -y -f wav -i /run/user/1000/tmpt9qeh4tl -f matroska /run/user/1000/tmp_fpjg2b6
format != extension, see also What are all of the file extensions supported by FFmpeg
but... pydub is unmaintained #389 #444
Steps to reproduce
m4a
file.m4a
file.Expected behavior
Export an m4a file correctly
Actual behavior
The following error happens.
Your System configuration