Android ffmpeg第二次运行失败

时间:2017-07-04 20:22:06

标签: android ffmpeg android-ffmpeg

我遇到https://github.com/WritingMinds/ffmpeg-android-java的问题。它是Android上ffmpeg的Java包装器,并且运行良好。但似乎你不能连续运行两个视频编码。实际上它只会在一生中对视频进行一次编码。每次下次尝试编码视频时,它都会冻结。这是我冻结时得到的输出:

Build.CPU_ABI : arm64-v8a
Loading FFmpeg for armv7 CPU
Running publishing updates method
ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (GCC)
  configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --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/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20160731-WA0005.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp41mp42isom
    creation_time   : 2016-07-31 17:24:29
  Duration: 00:00:13.63, start: 0.000000, bitrate: 1641 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 544x960, 1573 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2016-07-31 17:24:29
      handler_name    : Core Media Video
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 62 kb/s (default)
    Metadata:
      creation_time   : 2016-07-31 17:24:29
      handler_name    : Core Media Audio

我不确定发生了什么。似乎ffmpeg在第一个编码之后留下了一些东西,锁定它以用于任何将来的编码。它只有在我卸载然后重新安装应用程序时才会起作用。

  • 如果你从后台杀了一个应用程序,这个问题仍然存在。
  • 如果你杀了它并重启设备问题仍然存在。
  • 如果您在设置中使用强制退出,则问题仍然存在。

只有重新安装才能让我对新视频进行一次编码。之后没有任何作用。

1 个答案:

答案 0 :(得分:0)

实际上非常简单。我在两次尝试中都使用相同的输出文件名。 ffmpeg问我是否要覆盖现有的。问题是这个lib没有记录该行。 onProgress监听器会在此之前记录最后一行,它看起来像是冻结了。

解决方案是添加" -y"会overwrite output file without asking

相关问题