我在使用FFmpeg
切割部分视频时遇到错误以下是我的代码
String[] cmd = {"ffmpeg -ss 0 -i "+mPath+" -t 30 -c copy "+ (Environment.getExternalStorageDirectory().getAbsolutePath()+"/sample.mp4")};
executeCommand(cmd);
功能executeCommand
void executeCommand(String[] cmd) {
try {
fFmpeg.execute(cmd, new FFmpegExecuteResponseHandler() {
@Override
public void onSuccess(String message) {
Toast.makeText(VideoFullScreen.this, "finished :" + message, Toast.LENGTH_SHORT).show();
}
@Override
public void onProgress(String message) {
}
@Override
public void onFailure(String message) {
Log.e("Error",message);
}
@Override
public void onStart() {
}
@Override
public void onFinish() {
}
});
} catch (FFmpegCommandAlreadyRunningException e) {
e.printStackTrace();
}
}
错误
ffmpeg version n3.0.1版权所有(c)2000-2016 FFmpeg开发人员
使用gcc 4.8(GCC)构建
配置: - 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
输出#0,mp4,到' ffmpeg -ss 0 -i /storage/emulated/0/Video/Demo.mp4 -t 30 -c copy /storage/emulated/0/sample.mp4' ;:
输出文件#0不包含任何流
答案 0 :(得分:6)
这是我自己的问题的答案
我的问题是我正在传递的命令字符串数组中
此答案是针对所有都面临
类似问题的人们的ffmpeg
使用ffmpeg
请确保您以正确的String Array
String[] cmd = {"-ss", "0", "-i" ,input_video_path, "-t" ,"30", "-c", "copy",output_video_path};
请勿在传递的参数和标志中添加任何extra space
{" -c"
是错误的}
ffmpeg
{"ffmpeg" is
错误} 希望这对某人有帮助