Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
Use -vf=scale=trunc(iw/2)*2:trunc(ih/2)*2 fix division by 2 error.
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Jan 25, 2018
1 parent 09ff664 commit a49612f
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/record_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
}
Expand Down

0 comments on commit a49612f

Please sign in to comment.