Home » Android » Android FFmpeg cant set quality of image

Android FFmpeg cant set quality of image

Posted by: admin November 1, 2017 Leave a comment

Questions:

I am working with FFmpeg on Android, I am trying to extract frames from a video every second. I made this command that works well:

final String cmd[] = {

            "-i",
            videoPath,
            "-vf",
            "fps=1",
            mediaStorageDir.getAbsolutePath() +
            "out%d.png"
    };

Now I want to reduce the quality of the extracted frames so I tried this but get the error:

final String cmd[] = {

            "-i",
            videoPath,
            "-vf",
            "fps=1",
            "-qscale:v 12",
            mediaStorageDir.getAbsolutePath() +
            "out%d.png"
    };

At least one output file must be specified

What is the problem? I have searched online a lot and cant find a solution to the problem, also is there a better way to reduce the quality of my extracted frames?

thanks

Answers:

PNG is lossless and ignores -qscale:v.

Use JPG instead which accepts a -qscale:v range of 2-31 where a lower value is a higher quality.