无法使用ffmpeg将MP3文件转换为PCM [英] Unable to convert MP3 file to PCM with ffmpeg

查看:271
本文介绍了无法使用ffmpeg将MP3文件转换为PCM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编译了ffmpeg来使用此配置转换mp3文件,因为ffmpeg的输出大小对我来说很重要,所以我已禁用ffmpeg中的所有内容:

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

但是当我想将mp3转换为pcm时,出现此错误:

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?

问题似乎出在输出格式上:

it seem that the problem is with output format:

请求的输出格式's16le'不是合适的输出格式,但我不知道该如何解决

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

推荐答案

更改为

--enable-muxer=mp3,pcm_s16le,wav \

这篇关于无法使用ffmpeg将MP3文件转换为PCM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆