Search code examples
androidffmpegandroid-ffmpeg

ffmpeg loosing quality video


Everything is good but my quality result of the video is too low , its my first time using ffmpeg

This is my command

I/System.out: "-y" "-noautorotate" "-ss" "0" "-t" "31" "-i" "/storage/emulated/0/Download/20210227_175547.mp4" "-vf" "crop=w=3837:h=2160:x=1:y=-2070" "-r" "15" "-vcodec" "mpeg4" "-acodec" "copy" "-b:v" "2500k" "/storage/emulated/0/VEditor/VideoCroper/20210227_175547-0-13.mp4"

Solution

  • Use libx264 instead of old mpeg4:

    I/System.out: "-y" "-noautorotate" "-ss" "0" "-t" "31" "-i" "/storage/emulated/0/Download/20210227_175547.mp4" "-vf" "crop=w=3837:h=2160:x=1:y=-2070" "-r" "15" "-vcodec" "libx264" "-crf" "23" "-acodec" "copy" "-movflags +faststart" "/storage/emulated/0/VEditor/VideoCroper/20210227_175547-0-13.mp4"
    

    Control quality with the -crf option. More info at FFmpeg Wiki: H.264.