Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Use -vf=scale=trunc(iw/2)*2:trunc(ih/2)*2 fix division by 2 error.
  • Loading branch information
manateelazycat committed Jan 25, 2018
1 parent 09ff664 commit a49612faed28fc70a98aa117839cc67d96b99761
Showing 1 changed file with 5 additions and 18 deletions.
@@ -155,18 +155,6 @@ void RecordProcess::recordVideo()
arguments << QString("ultrafast");
arguments << savePath;
} else {
// NOTE: yuv420p can make mp4 file play on mobile phone,
// but yuv420p will make ffmpeg got error "width/height not divisible by 2".
// It's welcome patch to me, to make mp4 file can play on mobile phone and fix ffmpeg error.

// Mp4 need size dvisible by 2.
// if (recordWidth % 2 != 0) {
// recordWidth -= 1;
// }
// if (recordHeight % 2 != 0) {
// recordHeight -= 1;
// }

arguments << QString("-video_size");
arguments << QString("%1x%2").arg(recordWidth).arg(recordHeight);
arguments << QString("-framerate");
@@ -176,13 +164,12 @@ void RecordProcess::recordVideo()
arguments << QString("-i");
arguments << QString(":0.0+%1,%2").arg(recordX).arg(recordY);

// NOTE: yuv420p can make mp4 file play on mobile phone,
// but yuv420p will make ffmpeg got error "width/height not divisible by 2".
// It's welcome patch to me, to make mp4 file can play on mobile phone and fix ffmpeg error.

// Most mobile mplayer can't decode yuv444p (ffempg default format) video, yuv420p looks good.
// arguments << QString("-pix_fmt");
// arguments << QString("yuv420p");
arguments << QString("-pix_fmt");
arguments << QString("yuv420p");

arguments << QString("-vf");
arguments << QString("scale=trunc(iw/2)*2:trunc(ih/2)*2");

arguments << savePath;
}

0 comments on commit a49612f

Please sign in to comment.