gpt4 book ai didi

android - 尝试使用 FFmPeg lib 在视频上添加标题

转载 作者:行者123 更新时间:2023-11-29 23:05:05 24 4
gpt4 key购买 nike

<分区>

我正在使用 Ff-mpeg 库在视频上添加文本。 lib 加载成功但在执行时它给我错误。

这是我显示错误命令的字符串::

String tetxcommand[]=new String[]{"ffmpeg -i /Phone storage/video.mp4 -vf drawtext=text='HELLLLLLO':x=10:y=H-th-10: fontfile=/path/to/font.ttf:fontsize=12:fontcolor=white:shadowcolor=black:shadowx=5:shadowy=5 /Phone storage/video.mp4"};

这是我的代码以及我如何使用 FFmpeg 库(我已经为加载 ffmpeg 创建了 2 个方法 1,为执行创建了 1 个方法,我在成功方法的 loadffmpedlLibrarymethod() 下调用执行方法)

public void LoadFFmpegLibrary()
{
if(ffmpeg==null)
{
ffmpeg = FFmpeg.getInstance(MainActivity.this);
try {
ffmpeg.loadBinary(new LoadBinaryResponseHandler() {

@Override
public void onStart() {
Log.e("ffmpef","Start to load");
}

@Override
public void onFailure() {
Log.e("ffmpef","failed to load");
}

@Override
public void onSuccess() {
Log.e("ffmpef","load Successfully");
ExcuteFfmpefLibrabry(mutevideocommand);
}

@Override
public void onFinish() {}
});
} catch (FFmpegNotSupportedException e) {
// Handle if FFmpeg is not supported by device
Log.e("ffmpef",e.toString());
}

}


}

public void ExcuteFfmpefLibrabry(String command[])
{

ffmpeg = FFmpeg.getInstance(MainActivity.this);
try {
// to execute "ffmpeg -version" command you just need to pass "-version"
ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {

@Override
public void onStart() {
Log.e("ffmpef","Exaction Start");
}

@Override
public void onProgress(String message) {}

@Override
public void onFailure(String message) {
Log.e("ffmpef","failed to Excute Command");
Log.e("ok",message);
}

@Override
public void onSuccess(String message) {
Log.e("ffmpef","Video Edited Successfully");
Log.e("ok",message);
}

@Override
public void onFinish() {

}
});
} catch (FFmpegCommandAlreadyRunningException e) {
Log.e("ffmpef",e.toString());
}
}

输出:

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
Unrecognized option 'i /Phone storage/video.mp4 -b:v 2097k -s 160x120 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -strict experimental /Phone storage/video.mp4'.
Error splitting the argument list: Option not found

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com