我正在尝试使用FFmpeg在Android应用程序中从多个视频中构建马赛克,我发现如何使用wiki。链接很好地说明了该过程,但在处理过程中出现此错误:
I / Videokit:开始在main中运行。
register_exit
term_init和解析选项。
D / Videokit:发生错误
我正在使用的库是WritingMinds,它是FFmpeg,适用于Android,使用x264,libass,fontconfig,freetype,fribidi和lame编译(支持Android 4.1+)。基本上,您编写了一个代码字符串数组,该数组传递给FFmpeg并为您运行FFmpeg。
很显然,这是一个解析错误,但是我相信我已经将命令整理了一下。我已经使用其他命令(例如修剪,静音音频等)测试了文件,位置和FFmpeg,并且只有镶嵌不起作用。我尝试了不同的选项,字符串操作,但没有用。此外,如果输入较大的错字错误,我还会看到OpenGl错误。 这是Wiki上的代码:
-i 1.avi -i 2.avi -i 3.avi -i 4.avi
-filter_complex "
nullsrc=size=640x480 [base];
[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];
[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];
[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];
[3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];
[base][upperleft] overlay=shortest=1 [tmp1];
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];
[tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3];
[tmp3][lowerright] overlay=shortest=1:x=320:y=240
"
-c:v libx264 output.mkv
这是Wiki上的代码
String[] m =new String[]{"-i",
DestPath1.toString(),
"-i",
DestPath2.toString(),
"-i",
DestPath3.toString(),
"-i",
DestPath4.toString(),
"-filter_complex",
"\"",
"nullsrc=size=640x480 [base];",
"[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];",
"[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];",
"[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];",
"[3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];",
"[base][upperleft], overlay=shortest=1", "[tmp1];",
"[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];",
"[tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3];",
"[tmp3][lowerright] overlay=shortest=1:x=320:y=240",
"\"",
" -c:v",
"libx264",
FinalPath.toString()};
execFFmpegBinary(m);
这是我发送给FFmpeg的字符串。
预期结果将是在外部存储器上的“ FinalPath”上创建的视频。但是,我收到一条错误消息,仅此而已。我的截止日期很紧,所以我很难切换到另一个系统上来学习它,因为我已经是FFmpeg的新手了。有什么建议吗?
更新:我已经实现了该库的错误处理程序,而不仅仅是FFmpeg部分,它把报告指向为(“ nullsrc”不是过滤器)。但是,我需要在其中放入(“)来运行代码,我将其用作(\“),这不能解决问题。由于过滤器后面的语句需要用引号引起来,所以不能删除它们。
Update2:这是当前日志:
D/FileLog: Started command : ffmpeg [Ljava.lang.String;@7931693
FAILED with output : 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/Pictures/appName/Vid1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.25.101
Duration: 00:00:45.05, start: 0.033333, bitrate: 694 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 460x258 [SAR 1:1 DAR 230:129], 562 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Pictures/appName/Vid2.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2017-01-15 09:57:32
Duration: 00:00:40.82, start: 0.000000, bitrate: 352 kb/s
Stream #1:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 360x360 [SAR 1:1 DAR 1:1], 253 kb/s, 28.90 fps, 29 tbr, 29 tbn, 58 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
Metadata:
creation_time : 2017-01-15 09:57:32
handler_name : IsoMedia File Produced by Google, 5-11-2011
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Pictures/appName/Vid3.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2017-12-15 12:10:56
Duration: 00:00:47.26, start: 0.000000, bitrate: 775 kb/s
Stream #2:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 480x480, 706 kb/s, 26.98 fps, 27 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2017-12-15 12:10:56
handler_name : Core Media Video
Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 65 kb/s (default)
Metadata:
creation_time : 2017-12-15 12:10:56
handler_name : Core Media Audio
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Pictures/appName/Vid4.mp4':
Metadata:
major_brand : mp42
minor_version : 19529854
compatible_brands: mp42isom
creation_time : 2017-12-17 10:05:07
Duration: 00:00:14.33, start: 0.000000, bitrate: 803 kb/s
Stream #3:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 k
D/FileLog: Finished command : ffmpeg [Ljava.lang.String;@7931693
V/FA: Inactivity, disconnecting from the service