Ffmpeg - 在Android上将Wav转换为OGG(某些设备上的元数据错误)

时间:2016-12-12 19:16:56

标签: android audio ffmpeg wav ogg

我在应用Wav文件中,我希望将其转换为OGG格式。

我正在使用ffmpeg库和此命令:

ffmpeg -i /storage/emulated/0/Test.wav -c:a libvorbis -q:a 5 /storage/emulated/0/Test.ogg

但我在某些Android设备上正确播放生成的OGG文件时遇到问题。如果我在标准MediaPlayer中打开此文件,那么我得到错误的文件持续时间,寻求也不是很好,但文件是完整和正确播放。例如在使用Android 5.1的华为M2上,但在三星Galaxy S5(使用Android 5.1)上生成的文件正常,播放也没问题。

你知道哪里有问题吗?

来自ffmpeg的完整输出:

ffmpeg version n2.6.2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9 (GCC) 20140827 (prerelease)
  configuration: --target-os=linux --cross-prefix=/home/chrono/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --enable-runtime-cpudetect --sysroot=/home/chrono/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libtheora --enable-libfdk-aac --enable-nonfree --enable-fontconfig --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 --pkg-config=/home/chrono/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/chrono/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/chrono/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp' --extra-ldflags='-L/home/chrono/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie -Wl,--fix-cortex-a8' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
 Input #0, wav, from '/storage/emulated/0/IAMDJ/MyLoops/mix folder/Test.wav':
   Metadata:
     encoder         : Lavf56.25.101
   Duration: 00:00:16.01, bitrate: 1411 kb/s
     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
 Output #0, ogg, to '/storage/emulated/0/Test.ogg':
   Metadata:
     encoder         : Lavf56.25.101
     Stream #0:0: Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp
  Metadata:
      encoder         : Lavc56.26.100 libvorbis
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
size=       4kB time=00:00:01.00 bitrate=  35.0kbits/s    
size=      27kB time=00:00:02.01 bitrate= 107.8kbits/s    
size=      48kB time=00:00:03.04 bitrate= 129.3kbits/s    
size=      70kB time=00:00:04.06 bitrate= 140.3kbits/s    
size=      91kB time=00:00:05.14 bitrate= 144.9kbits/s    
size=     113kB time=00:00:06.15 bitrate= 149.7kbits/s    
video:0kB audio:344kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 1.994279%

编辑:这是结果文件:Test.ogg

编辑2:标准MediaPlayer可能存在问题,但正确播放了另一个Ogg文件。

0 个答案:

没有答案