jiaaro / pydub

Manipulate audio with a simple and easy high level interface
http://pydub.com
MIT License
8.78k stars 1.03k forks source link

Requested output format 'pcm' is not a suitable output format #517

Open yuanjie-ai opened 4 years ago

yuanjie-ai commented 4 years ago

song[:30*1000].export("test.pcm", format="pcm", bitrate="192k")



CouldntEncodeError Traceback (most recent call last)

in ----> 1 song[:30*1000].export("test.pcm", format="pcm", bitrate="192k") /usr/local/lib/python3.6/dist-packages/pydub/audio_segment.py in export(self, out_f, format, codec, bitrate, parameters, tags, id3v2_version, cover) 911 raise CouldntEncodeError( 912 "Encoding failed. ffmpeg/avlib returned error code: {0}\n\nCommand:{1}\n\nOutput from ffmpeg/avlib:\n\n{2}".format( --> 913 p.returncode, conversion_command, p_err.decode(errors='ignore') )) 914 915 output.seek(0) CouldntEncodeError: Encoding failed. ffmpeg/avlib returned error code: 1 Command:['ffmpeg', '-y', '-f', 'wav', '-i', '/tmp/tmpaat2lgas', '-b:a', '192k', '-f', 'pcm', '/tmp/tmpn62f6h6e'] Output from ffmpeg/avlib: ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, wav, from '/tmp/tmpaat2lgas': Duration: 00:00:30.00, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s [NULL @ 0x55ad0676d6e0] Requested output format 'pcm' is not a suitable output format /tmp/tmpn62f6h6e: Invalid argument
GreyAlien502 commented 3 years ago

pcm is not a valid ffmpeg format There are multiple different formats that would count as PCM. See https://trac.ffmpeg.org/wiki/audio%20types for details.