我试图通过
中的ffmpeg在视频中添加文字"-i", "/storage/emulated/0/videoplayback.mp4", "-vf","drawtext=fontfile=file:///android_asset/fonts/georgia.ttf:text='Text_to_write':fontsize=20:x=100:y=100","-codec:a", "copy", newVideoPath
并将错误日志显示为
ffmpeg version n4.0-39-gda39990 Copyright (c) 2000-2018 the FFmpeg
developers
built with gcc 4.9.x (GCC) 20150123 (prerelease)
configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi-
--arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
libavutil56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/videoplayback.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-05-19T10:21:06.000000Z
Duration: 00:00:27.07, start: 0.000000, bitrate: 730 kb/s
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 640x360 [SAR 1:1 DAR 16:9], 639 kb/s, 29.83 fps, 29.83 tbr,
29827 tbn, 59.65 tbc (default)
Metadata:
creation_time : 2018-05-19T10:21:06.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 05/19/2018.
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
Metadata:
creation_time : 2018-05-19T10:21:06.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 05/19/2018.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Fontconfig error: Cannot load default config file
[Parsed_drawtext_0 @ 0xb7af4560] impossible to init fontconfig
[AVFilterGraph @ 0xb7af3870] Error initializing filter 'drawtext' with args
'fontfile=file:///android_asset/fonts/georgia.ttf:text=Text_to_write:fontsize=20:x=100:y=100'
Error reinitializing filters!
Failed to inject frame into filter network: Unknown error occurred
Error while processing the decoded data for stream #0:0
Conversion failed!
答案 0 :(得分:0)
使用fontfile=/android_asset/fonts/georgia.ttf
代替fontfile=file:///android_asset/fonts/georgia.ttf
。
file://
是不必要的。
答案 1 :(得分:0)
您需要为drawtext过滤器提供fontconfig_file。 看答案 FFMpeg drawtext