想要使用ffmpeg以1:1的方式裁剪视频,但它会出错工作目录:null环境:null

时间:2017-09-14 10:11:37

标签: android ffmpeg android-ffmpeg

我使用以下命令从默认相机最初捕获的裁剪视频。但是当我执行命令时,它会给出以下错误。

 final String[] cmd={"-i", "/storage/emulated/0/DCIM/ZyfVideo/VID_20170914_153804.mp4","-s", "480x480" ,"-vf" ,"crop=480:480","setdar=1:1","setsar=1:1 ","/storage/emulated/0/Movies/SpoofApp/VDO_20170914_153811.mp4"};

错误Logcat:

09-14 15:38:11.874 3872-4039/com.spoof.app E/FFmpeg: Exception while trying to run: [Ljava.lang.String;@427ce088
                                                     java.io.IOException: Error running exec(). Command: [/data/data/com.spoof.app/files/ffmpeg, -i, /storage/emulated/0/DCIM/ZyfVideo/VID_20170914_153804.mp4, -s, 480x480, -vf, crop=480:480, setdar=1:1, setsar=1:1 , /storage/emulated/0/Movies/SpoofApp/VDO_20170914_153811.mp4] Working Directory: null Environment: null
                                                         at java.lang.ProcessManager.exec(ProcessManager.java:211)
                                                         at java.lang.Runtime.exec(Runtime.java:173)
                                                         at java.lang.Runtime.exec(Runtime.java:128)
                                                         at com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10)
                                                         at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38)
                                                         at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10)
                                                         at android.os.AsyncTask$2.call(AsyncTask.java:288)
                                                         at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                         at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                                                         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                         at java.lang.Thread.run(Thread.java:841)
                                                      Caused by: java.io.IOException: No such file or directory
                                                         at java.lang.ProcessManager.exec(Native Method)
                                                         at java.lang.ProcessManager.exec(ProcessManager.java:209)
                                                         at java.lang.Runtime.exec(Runtime.java:173) 
                                                         at java.lang.Runtime.exec(Runtime.java:128) 
                                                         at com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10) 
                                                         at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38) 
                                                         at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10) 
                                                         at android.os.AsyncTask$2.call(AsyncTask.java:288) 
                                                         at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
                                                         at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
                                                         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
                                                         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
                                                         at java.lang.Thread.run(Thread.java:841) 

1 个答案:

答案 0 :(得分:0)

我对ffmpeg没有这样的想法,但我可以告诉你关于易于使用的jCodec lib。

访问jcodec.org。

如果你想裁剪视频,你必须在android或java中执行下面的步骤。 1.从jcodec的实用方法中获取帧。 2.使用Bitmap助手类进行裁剪。 3.使用jcodec utilty函数以mp4格式打包。

如果你不能这样做,请给我发邮件sunilgupta3443@gmail.com

我将帮助您在Android中制作裁剪视频应用程序。

谢谢