ffmpeg正在生成错误消息,因为它不喜欢我包含的png文件。 png以图标开头,但我认为ffmpeg希望它成为一个文件。我是否必须这样做以使其可用于ffmpeg?这是我的所作所为:
Bitmap watermark = BitmapFactory.decodeResource(getResources(), R.drawable.watermark);
FileOutputStream fos = model.controller.openFileOutput("watermark.png", Context.MODE_PRIVATE);
ObjectOutputStream of = new ObjectOutputStream(fos);
boolean success = watermark.compress(Bitmap.CompressFormat.PNG, 100, of);
of.flush();
of.close();
我以这种方式提供ffmpeg的文件路径:
String watermarkPath = model.getFilesDir() + "/watermark.png";
结果是:
/data/user/0/com.example.example/files/watermark.png
我用这个数组调用ffmpeg
String [] splitString = new String[]
{
"-i", fileName,
"-i", watermarkPath,
"-filter_complex", "overlay=10:10",
newFileName};
我收到这些有关PNG的错误消息。
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 '/data/user/0/com.scenebot.scenebot/files/32ec5e5e-29e6-4f9a-99ae-04d0ab9d74a1.MP4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-05-17 04:09:21
com.android.version: 7.0
Duration: 00:00:02.80, start: 0.000000, bitrate: 17103 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m), 1920x1080, 16846 kb/s, SAR 1:1 DAR 16:9, 29.67 fps, 29.67 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2018-05-17 04:09:21
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 255 kb/s (default)
Metadata:
creation_time : 2018-05-17 04:09:21
handler_name : SoundHandle
[png @ 0xf44fe800] Invalid PNG signature 0xACED00057A000004.
[image2 @ 0xf44af600] decoding for stream 0 failed
[image2 @ 0xf44af600] Could not find codec parameters for stream 0 (Video: png, none(pc)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
/data/user/0/com.scenebot.scenebot/files/watermark.png: could not find codec parameters
Input #1, image2, from '/data/user/0/com.scenebot.scenebot/files/watermark.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: 3678 kb/s
Stream #1:0: Video: png, none(pc), 25 tbr, 25 tbn, 25 tbc
[buffer @ 0xf4350000] Unable to parse option value "0x0" as image size
[buffer @ 0xf4350000] Unable to parse option value "-1" as pixel format
[buffer @ 0xf4350000] Unable to parse option value "0x0" as image size
[buffer @ 0xf4350000] Error setting option video_size to value 0x0.
[graph 0 input from stream 1:0 @ 0xf44ab220] Error applying options to the filter.
Error configuring complex filters.
Invalid argument
我一直在研究这个问题大约四个小时。我疯了。