Unable to convert MP3 file to PCM with ffmpeg

2019-08-30 06:02发布

I have compiled ffmpeg to convert mp3 file with this config, as the ffmpeg output size is matter to me, I have disabled everything in ffmpeg:

#!/bin/bash

. abi_settings.sh $1 $2 $3

pushd ffmpeg

case $1 in
  armeabi-v7a | armeabi-v7a-neon)
    CPU='cortex-a8'
  ;;
  x86)
    CPU='i686'
  ;;
esac

make clean

./configure \
--target-os="$TARGET_OS" \
--cross-prefix="$CROSS_PREFIX" \
--arch="$NDK_ABI" \
--cpu="$CPU" \
--enable-runtime-cpudetect \
--sysroot="$NDK_SYSROOT" \
--disable-all \
--disable-network \
--enable-avcodec \
--enable-avformat \
--enable-swresample \
--enable-avfilter \
--enable-parser=mpegaudio \
--enable-demuxer=mp3,wav \
--enable-muxer=mp3,wav \
--enable-decoder=pcm*,mp3*\
--enable-encoder=pcm*,libmp3lame \
--enable-filter=aresample \
--enable-protocol=file \
--enable-ffmpeg \
--enable-libmp3lame \
--enable-pthreads \
--disable-debug \
--disable-ffserver \
--enable-version3 \
--enable-hardcoded-tables \
--disable-ffplay \
--disable-ffprobe \
--enable-gpl \
--enable-yasm \
--disable-doc \
--disable-shared \
--enable-static \
--enable-small \
--enable-nonfree \
--pkg-config="${2}/ffmpeg-pkg-config" \
--prefix="${2}/build/${1}" \
--extra-cflags="-I${TOOLCHAIN_PREFIX}/include $CFLAGS" \
--extra-ldflags="-L${TOOLCHAIN_PREFIX}/lib $LDFLAGS" \
--extra-libs="-lm" \
--extra-cxxflags="$CXX_FLAGS" || exit 1

make -j${NUMBER_OF_CORES} && make install || exit 1

popd

but when I want to convert mp3 to pcm, I get this error:

configuration: --target-os=linux --cross-prefix=/root/ffmpeg2/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/ffmpeg2/ffmpeg-android/toolchain-android/sysroot --disable-all --disable-network --enable-avcodec --enable-avformat --enable-swresample --enable-avfilter --enable-parser=mpegaudio --enable-demuxer='mp3,wav' --enable-muxer='mp3,wav' --enable-decoder='pcm*,mp3*--enable-encoder=pcm*,libmp3lame' --enable-filter=aresample --enable-protocol=file --enable-ffmpeg --enable-libmp3lame --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --enable-small --enable-nonfree --pkg-config=/root/ffmpeg2/ffmpeg-android/ffmpeg-pkg-config --prefix=/root/ffmpeg2/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/ffmpeg2/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/ffmpeg2/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs=-lm --extra-cxxflags=
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavfilter     6. 31.100 /  6. 31.100
  libswresample   2.  0.101 /  2.  0.101
[mp3 @ 0xb72041d0] Skipping 0 bytes of junk at 0.
[mp3 @ 0xb72041d0] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 0xb72041d0] Could not find codec parameters for stream 0 (Audio: mp3, 44100 Hz, 1 channels, 256 kb/s): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
/storage/emulated/0/Android/data/com.edspace.alefba/files/alefba/page/voices/109/cource_1.mp3: could not find codec parameters
Guessed Channel Layout for  Input Stream #0.0 : mono
Input #0, mp3, from '/storage/emulated/0/Android/data/com.edspace.alefba/files/alefba/page/voices/109/cource_1.mp3':
  Duration: 00:00:08.67, start: 0.000000, bitrate: 256 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, 1 channels, 256 kb/s
[NULL @ 0xb7242370] Requested output format 's16le' is not a suitable output format
/storage/emulated/0/Android/data/com.edspace.alefba/files/alefba/page/voices/109/cource_1.pcm: Invalid 

what should I change in configure parameters to make it work?

EDIT:

it seem that the problem is with output format:

Requested output format 's16le' is not a suitable output format , but I do not know how can I fix that

标签: ffmpeg
1条回答
看我几分像从前
2楼-- · 2019-08-30 06:35

Change to

--enable-muxer=mp3,pcm_s16le,wav \
查看更多
登录 后发表回答