Search code examples
androidvideoffmpegmotion

Android, How to convert video into slow motion and play it in slow motion using FFmpeg


In Android, How to convert video into slow motion and play it in slow motion using FFmpeg.

I am using FFmpeg command :

ffmpeg -i input.mkv -filter:v "setpts=2.0*PTS" output.mkv

Link : https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video

but i can't pass "setpts=2.0*PTS" command with Double Quote in String

    String cmd1 = "-i " + inputpath.mp4 + " " + "-filter:v" + " " 
+ "setpts=0.5*PTS"  
+ " " +
Environment.getExternalStorageDirectory().getAbsolutePath() + "/hij.mp4";

if you have any better solution for converting video into slow motion or fast motion then it will be appreciated.

Thanks.


Solution

  • What about this?

    String cmd1 = "-i " + inputpath.mp4 + " " + "-filter:v" + " " + "\"setpts=0.5*PTS\"" + " " + Environment.getExternalStorageDirectory().getAbsolutePath() + "/hij.mp4";

    Just escape the double quotes with backslashes.