我想在我的库中使用ffmpeg lib。为此目的,我已成功编译它。但是当我尝试执行任何命令时,我收到此消息:
Invalid data found when processing input.
我不知道背后的原因是什么。这是代码:
public class Videokit extends Activity {
String FilePath;
String OutPut;
Context mycontext;
Videokit vk ;
static
{
System.loadLibrary("videokit");
}
public native void run(String[] args);
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
FilePath =Environment.getExternalStorageDirectory().toString()+"/output.3gp";
try {
ffmpegrun();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String ffmpegrun() throws IOException
{
boolean success=false;
File folder = new File(Environment.getExternalStorageDirectory().toString() + "/image-%3d.jpeg");
File file = new File(FilePath);
System.out.println("filepath exists at:"+file.getAbsolutePath());
if (!folder.exists()) {
success = folder.mkdirs();
// Toast.makeText(mycontext,"outfile.mp4 exists at"+folder.getAbsolutePath(),Toast.LENGTH_LONG).show();
OutPut = folder.getAbsolutePath();
}
System.out.println("outfile.flv exists at:"+folder.getAbsolutePath());
run(new String[]{
"ffmpeg",
"-i",
FilePath,
"-r 1",
"-f",
"image2",
"image-%3d.jpeg"
});
return OutPut;
}
}
这是日志:
10-07 17:00:03.707: D/dalvikvm(8760): Trying to load lib /data/data/uk.co.halfninja.videokit/lib/libvideokit.so 0x44e8c958
10-07 17:00:03.837: D/dalvikvm(8760): Added shared lib /data/data/uk.co.halfninja.videokit/lib/libvideokit.so 0x44e8c958
10-07 17:00:03.837: I/Videokit(8760): Loading native library compiled at 13:52:27 Oct 7 2012
10-07 17:00:03.917: I/System.out(8760): filepath exists at:/sdcard/output.3gp
10-07 17:00:03.917: I/System.out(8760): outfile.flv exists at:/sdcard/image-%3d.jpeg
10-07 17:00:03.917: D/dalvikvm(8760): +++ not scanning '/system/lib/libwebcore.so' for 'run' (wrong CL)
10-07 17:00:03.917: D/dalvikvm(8760): +++ not scanning '/system/lib/libmedia_jni.so' for 'run' (wrong CL)
10-07 17:00:03.928: D/dalvikvm(8760): +++ not scanning '/system/lib/libexif.so' for 'run' (wrong CL)
10-07 17:00:03.928: D/Videokit(8760): run() called
10-07 17:00:03.928: D/Videokit(8760): run passing off to main()
10-07 17:00:03.928: D/Videokit(8760): main(): registering all modules
10-07 17:00:03.938: D/Videokit(8760): main(): registered everything
10-07 17:00:03.938: D/Videokit(8760): main(): initting opts
10-07 17:00:03.968: D/Videokit(8760): main(): initted opts.
10-07 17:00:03.968: E/Videokit(8760): ffmpeg version N-30996-gf925b24, Copyright (c) 2000-2011 the FFmpeg developers
10-07 17:00:03.979: E/Videokit(8760): built on Oct 7 2012 13:52:32 with gcc 4.4.3
10-07 17:00:03.979: E/Videokit(8760): configuration: --enable-cross-compile --arch=arm5te --enable-armv5te --target-os=linux --disable-stripping --prefix=../output --disable-neon --enable-version3 --disable-shared --enable-static --enable-gpl --enable-memalign-hack --cc=arm-linux-androideabi-gcc --ld=arm-linux-androideabi-ld --extra-cflags='-fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated' --disable-everything --enable-decoder=mjpeg --enable-demuxer=mjpeg --enable-parser=mjpeg --enable-demuxer=image2 --enable-muxer=mp4 --enable-encoder=libx264 --enable-libx264 --enable-decoder=rawvideo --enable-protocol=file --enable-hwaccels --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-filter=buffer --enable-filter=buffersink --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-indev=v4l --disable-indev=v4l2 --extra-cflags='-I../x264 -Ivideokit' --extra-ldflags=-L../x264
10-07 17:00:03.987: D/Videokit(8760): main(): parsing options
10-07 17:00:03.987: D/Videokit(8760): parse_options has 7 options to parse
10-07 17:00:04.050: E/Videokit(8760): /sdcard/output.3gp: Invalid data found when processing input
10-07 17:00:04.050: E/Videokit(8760): ffmpeg_exit(1) called!
请帮助我。我对这个问题一无所知。谢谢你。