I have used below command for crop video from originally captured by default camera. But when i was execute command it gives below error.
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"};
Error 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)
I have no such idea about ffmpeg but i can tell you about jCodec lib which is easy to use.
visit jcodec.org.
if you want to crop the video you will have to do below step in android or java. 1. get the frame from utility method from jcodec. 2. crop using Bitmap helper class. 3. pack in the mp4 format using jcodec utilty function.
if you are not able to do this kindly write a mail to me [email protected]
I will help to make the crop video application for you in android.
Thank you