Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio_segment = AudioSegment.from_file(audio_memory_file, "wav") doesnt work with <InMemoryUploadedFile: output_audio.wav (audio/wave)> #704

Open
bhupesh-openenglish opened this issue Sep 28, 2023 · 0 comments

Comments

@bhupesh-openenglish
Copy link

bhupesh-openenglish commented Sep 28, 2023

Steps to reproduce

So when i make a post reqeuset i take a file using request.files['audio_file'] and <InMemoryUploadedFile: output_audio.wav (audio/wave)> this will be format which comes in django app now when i run the audio_segment = AudioSegment.from_file(audio_memory_file, "wav") this line throws me an error and i tried with mp3 files too and getting error with ffmpeg

audio_segment = AudioSegment.from_file(audio_memory_file, "wav")
(Pdb) n
pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1

Output from ffmpeg/avlib:

ffmpeg version 5.1.1-1ubuntu2.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-3ubuntu1)
  configuration: --prefix=/usr --extra-version=1ubuntu2.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[wav @ 0x55b4314fb9c0] invalid start code [0][0][0][0] in RIFF header
[cache @ 0x55b4314fc1c0] Statistics, cache hits:0 cache misses:0
cache:pipe:0: Invalid data found when processing input

System information

(Delete all the statements that don't apply.)

My system is Ubuntu 20. (For example, "Ubuntu 16.04 LTS x64", "Windows 10 x64", or "macOS Sierra".)

My Python version is 3.10. (You can check this by running python -V.)

My Pip version is . (You can check this by running pip -V.)

My SpeechRecognition library version is latest updates. (You can check this by running python -c "import speech_recognition as sr;print(sr.__version__)".)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant