我编译了FFmpeg for Android(https://gitorious.org/android-ffmpeg)但是当我尝试做一些操作(例如过滤器裁剪,转置,修剪等)时,它会在5个案例中崩溃。 错误日志不一样,所以我认为它可能是由内存问题引起的。 我正在使用OSX,NDK android-ndk-r9b:darwing x86_64。 本机ffmpeg方法将args传递给ffmpeg.c main方法。它在Activity中的AsyncTask中执行。 提前致谢
编辑: 我忘了提到程序算法运行如下: 按下按钮 - >打开相机意图 - >开始录制 - >将复制文件记录到项目文件夹(在SD卡上)后 - >打开编辑活动+启动asynctask
EDIT2: 在具有不同视频分辨率的HTC ONE上测试
ffmpeg的版本和配置
11-20 12:15:23.001: I/ff-log(19091): ffmpeg version 0.10.2.git
11-20 12:15:23.001: I/ff-log(19091): Copyright (c) 2000-2012 the FFmpeg developers
11-20 12:15:23.001: I/ff-log(19091): built on Nov 20 2013 12:12:46 with gcc 4.6 20120106 (prerelease)
11-20 12:15:23.001: I/ff-log(19091): configuration: --target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a --disable-ffplay --disable-ffserver --disable-network --disable-avdevice --enable-protocol=file --enable-hwaccel=mpeg4_vaapi --enable-hwaccel=h264_vaapi --sysroot=/Users/dpc/Developer/android-ndk-r9b/platforms/android-9/arch-arm --disable-decoder=h264_vdpau --prefix=build/armv7-a --disable-asm --enable-small --disable-everything --enable-decoder=mjpeg --enable-parser=mjpeg --enable-muxer=mp4 --enable-muxer=h264 --enable-muxer=h263 --enable-muxer=yuv4mpegpipe --enable-muxer=mov --enable-demuxer=mpegvideo --enable-demuxer=mjpeg --enable-demuxer=image2 --enable-demuxer=mp4 --enable-demuxer=aac --enable-demuxer=ac3 --enable-demuxer=mp3 --enable-demuxer=yuv4mpegpipe --enable-demuxer=mov --enable-decoder=mpegvideo --enable-decoder=mpeg4 --enable-decoder=mp3 --enable-decoder=ac3 --enable-decoder=aac --enable-decoder=h264 --enable-decoder=h263 --enable-decoder=rawvideo --enable-decoder=yuv4 --enable-decoder=png --enable
样本命令:
1-20 12:15:22.991: I/FFMPEG(19091): CMD:-i file:/storage/emulated/0/.project/videos/mac_video_tmp.mp4 -vf crop=1079:1079:0:420 -vcodec mpeg4 -sameq -acodec copy file:/storage/emulated/0/.project/videos/croppedVid.mp4
一些输出错误:
第一类:
11-20 12:15:23.011: I/ff-log(19091): libavutil 51. 46.100 / 51. 46.100
11-20 12:15:23.011: I/ff-log(19091): libavcodec 54. 14.101 / 54. 14.101
11-20 12:15:23.011: I/ff-log(19091): libavformat 54. 3.100 / 54. 3.100
11-20 12:15:23.011: I/ff-log(19091): libavfilter 2. 70.100 / 2. 70.100
11-20 12:15:23.011: I/ff-log(19091): libswscale 2. 1.100 / 2. 1.100
11-20 12:15:23.011: I/ff-log(19091): libswresample 0. 11.100 / 0. 11.100
11-20 12:15:23.011: I/ff-log(19091): before parsing options
11-20 12:15:23.011: I/ff-log(19091): before parsing options
11-20 12:15:23.011: I/ff-log(19091): parse options
11-20 12:15:23.011: I/ff-log(19091): prepare app arguments !!! NOT defined(_WIN32) && !defined(__MINGW32CE__) !
11-20 12:15:23.011: I/ff-log(19091): after prepare app arguments
11-20 12:15:23.011: I/ff-log(19091): ffurl_open: file:/storage/emulated/0/.project/videos/mac_video_tmp.mp4, 1
11-20 12:15:23.011: I/ff-log(19091): ffurl_alloc: file:/storage/emulated/0/.project/videos/mac_video_tmp.mp4, 1
11-20 12:15:23.011: I/ff-log(19091): ffurl_alloc: file
11-20 12:15:23.011: I/ff-log(19091): ffurl_open alloc: 0
11-20 12:15:23.011: I/ff-log(19091): ffurl_connect
11-20 12:15:23.011: I/ff-log(19091): ffurl_open connect: 0
11-20 12:15:23.011: I/ff-log(19091): Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
11-20 12:15:23.011: I/ff-log(19091): ISO: File Type Major Brand: isom
11-20 12:15:23.021: I/ff-log(19091): File position before avformat_find_stream_info() is 8458240
11-20 12:15:23.041: A/libc(19091): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 19091 (t.android.utils)
第二种类型:
11-20 12:17:04.800: I/ff-log(19632): libavutil 51. 46.100 / 51. 46.100
11-20 12:17:04.800: I/ff-log(19632): libavcodec 54. 14.101 / 54. 14.101
11-20 12:17:04.800: I/ff-log(19632): libavformat 54. 3.100 / 54. 3.100
11-20 12:17:04.800: I/ff-log(19632): libavfilter 2. 70.100 / 2. 70.100
11-20 12:17:04.800: I/ff-log(19632): libswscale 2. 1.100 / 2. 1.100
11-20 12:17:04.800: I/ff-log(19632): libswresample 0. 11.100 / 0. 11.100
11-20 12:17:04.800: I/ff-log(19632): before parsing options
11-20 12:17:04.800: I/ff-log(19632): before parsing options
11-20 12:17:04.800: I/ff-log(19632): parse options
11-20 12:17:04.800: I/ff-log(19632): prepare app arguments !!! NOT defined(_WIN32) && !defined(__MINGW32CE__) !
11-20 12:17:04.800: I/ff-log(19632): after prepare app arguments
11-20 12:17:04.800: I/ff-log(19632): opt_output_file ܞ�f��f��f��f���flated/0/.project/videos/mac_video_tmp.mp4
11-20 12:17:04.800: I/ff-log(19632): ffurl_alloc: ܞ�f��f��f��f���flated/0/.project/videos/mac_video_tmp.mp4, 0
11-20 12:17:04.800: I/ff-log(19632): ffurl_alloc: file
11-20 12:17:04.800: I/ff-log(19632): ffurl_open: ܞ�f��f��f��f���flated/0/.project/videos/mac_video_tmp.mp4, 2
11-20 12:17:04.800: I/ff-log(19632): ffurl_alloc: ܞ�f��f��f��f���flated/0/.project/videos/mac_video_tmp.mp4, 2
11-20 12:17:04.800: I/ff-log(19632): ffurl_alloc: file
11-20 12:17:04.800: I/ff-log(19632): ffurl_open alloc: 0
11-20 12:17:04.800: I/ff-log(19632): ffurl_connect
11-20 12:17:04.800: I/ff-log(19632): ffurl_open connect: -2
11-20 12:17:04.800: I/ff-log(19632): ffurl_open FAIL
11-20 12:17:04.800: I/ff-log(19632): ܞ�f��f��f��f���flated/0/.project/videos/mac_video_tmp.mp4: No such file or directory
(CHARSER就像输出LOGCAT一样)
第三种类型:
11-20 12:18:23.243: I/ff-log(19867): libavutil 51. 46.100 / 51. 46.100
11-20 12:18:23.243: I/ff-log(19867): libavcodec 54. 14.101 / 54. 14.101
11-20 12:18:23.243: I/ff-log(19867): libavformat 54. 3.100 / 54. 3.100
11-20 12:18:23.243: I/ff-log(19867): libavfilter 2. 70.100 / 2. 70.100
11-20 12:18:23.243: I/ff-log(19867): libswscale 2. 1.100 / 2. 1.100
11-20 12:18:23.243: I/ff-log(19867): libswresample 0. 11.100 / 0. 11.100
11-20 12:18:23.243: I/ff-log(19867): before parsing options
11-20 12:18:23.243: I/ff-log(19867): before parsing options
11-20 12:18:23.243: I/ff-log(19867): parse options
11-20 12:18:23.243: I/ff-log(19867): prepare app arguments !!! NOT defined(_WIN32) && !defined(__MINGW32CE__) !
11-20 12:18:23.243: I/ff-log(19867): after prepare app arguments
11-20 12:18:23.243: I/ff-log(19867): Unknown decoder '��f('
11-20 12:18:23.243: I/ff-log(19867): exit_program 1
11-20 12:18:23.243: I/ff-log(19867): exit_program 1
11-20 12:18:23.243: I/ff-log(19867): exit_program 2
11-20 12:18:23.253: A/libc(19867): @@@ ABORTING: invalid address or address of corrupt block 0x1d3422d passed to dlfree
11-20 12:18:23.253: A/libc(19867): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 20393 (AsyncTask #2)
第4种类型:
11-20 12:20:07.214: I/ff-log(20660): libavutil 51. 46.100 / 51. 46.100
11-20 12:20:07.214: I/ff-log(20660): libavcodec 54. 14.101 / 54. 14.101
11-20 12:20:07.214: I/ff-log(20660): libavformat 54. 3.100 / 54. 3.100
11-20 12:20:07.214: I/ff-log(20660): libavfilter 2. 70.100 / 2. 70.100
11-20 12:20:07.214: I/ff-log(20660): libswscale 2. 1.100 / 2. 1.100
11-20 12:20:07.214: I/ff-log(20660): libswresample 0. 11.100 / 0. 11.100
11-20 12:20:07.214: I/ff-log(20660): before parsing options
11-20 12:20:07.214: I/ff-log(20660): before parsing options
11-20 12:20:07.214: I/ff-log(20660): parse options
11-20 12:20:07.214: I/ff-log(20660): prepare app arguments !!! NOT defined(_WIN32) && !defined(__MINGW32CE__) !
11-20 12:20:07.214: I/ff-log(20660): after prepare app arguments
11-20 12:20:07.214: I/ff-log(20660): Unknown decoder ''
11-20 12:20:07.214: I/ff-log(20660): exit_program 1
11-20 12:20:07.214: A/libc(20660): Fatal signal 11 (SIGSEGV) at 0x2d007165 (code=1), thread 21017 (AsyncTask #2)