FFmpeg 错误输出文件 #0 不包含任何流
FFmpeg error Output file #0 does not contain any stream
我在使用 FFmpeg 剪切部分视频时遇到错误
以下是我的代码
String[] cmd = {"ffmpeg -ss 0 -i "+mPath+" -t 30 -c copy "+ (Environment.getExternalStorageDirectory().getAbsolutePath()+"/sample.mp4")};
executeCommand(cmd);
函数执行命令
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 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
Output #0, mp4, to 'ffmpeg -ss 0 -i /storage/emulated/0/Video/Demo.mp4 -t 30 -c copy /storage/emulated/0/sample.mp4':
Output file #0 does not contain any stream
This is an answer to my own question
我的问题出在我传递的命令字符串数组中
This answer is to the people who all are facing the similar kind of issues with ffmpeg
使用时应遵循的重要事项ffmpeg
确保您以正确的方式传递命令 String Array
String[] cmd = {"-ss", "0", "-i" ,input_video_path, "-t" ,"30", "-c", "copy",output_video_path};
不要在传递的参数和标志中添加任何 extra space
{" -c"
错误}
- 不要在cmd数组中传递
ffmpeg
{"ffmpeg" is
错了}
希望这会对某人有所帮助
我在使用 FFmpeg 剪切部分视频时遇到错误
以下是我的代码
String[] cmd = {"ffmpeg -ss 0 -i "+mPath+" -t 30 -c copy "+ (Environment.getExternalStorageDirectory().getAbsolutePath()+"/sample.mp4")};
executeCommand(cmd);
函数执行命令
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 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
Output #0, mp4, to 'ffmpeg -ss 0 -i /storage/emulated/0/Video/Demo.mp4 -t 30 -c copy /storage/emulated/0/sample.mp4':
Output file #0 does not contain any stream
This is an answer to my own question
我的问题出在我传递的命令字符串数组中
This answer is to the people who all are facing the similar kind of issues with
ffmpeg
使用时应遵循的重要事项ffmpeg
确保您以正确的方式传递命令
String Array
String[] cmd = {"-ss", "0", "-i" ,input_video_path, "-t" ,"30", "-c", "copy",output_video_path};
不要在传递的参数和标志中添加任何
extra space
{" -c"
错误}- 不要在cmd数组中传递
ffmpeg
{"ffmpeg" is
错了}
希望这会对某人有所帮助