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

Commit a49612f

Browse files
Use -vf=scale=trunc(iw/2)*2:trunc(ih/2)*2 fix division by 2 error.
1 parent 09ff664 commit a49612f

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

src/record_process.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,6 @@ void RecordProcess::recordVideo()
155155
arguments << QString("ultrafast");
156156
arguments << savePath;
157157
} else {
158-
// NOTE: yuv420p can make mp4 file play on mobile phone,
159-
// but yuv420p will make ffmpeg got error "width/height not divisible by 2".
160-
// It's welcome patch to me, to make mp4 file can play on mobile phone and fix ffmpeg error.
161-
162-
// Mp4 need size dvisible by 2.
163-
// if (recordWidth % 2 != 0) {
164-
// recordWidth -= 1;
165-
// }
166-
// if (recordHeight % 2 != 0) {
167-
// recordHeight -= 1;
168-
// }
169-
170158
arguments << QString("-video_size");
171159
arguments << QString("%1x%2").arg(recordWidth).arg(recordHeight);
172160
arguments << QString("-framerate");
@@ -176,13 +164,12 @@ void RecordProcess::recordVideo()
176164
arguments << QString("-i");
177165
arguments << QString(":0.0+%1,%2").arg(recordX).arg(recordY);
178166

179-
// NOTE: yuv420p can make mp4 file play on mobile phone,
180-
// but yuv420p will make ffmpeg got error "width/height not divisible by 2".
181-
// It's welcome patch to me, to make mp4 file can play on mobile phone and fix ffmpeg error.
182-
183167
// Most mobile mplayer can't decode yuv444p (ffempg default format) video, yuv420p looks good.
184-
// arguments << QString("-pix_fmt");
185-
// arguments << QString("yuv420p");
168+
arguments << QString("-pix_fmt");
169+
arguments << QString("yuv420p");
170+
171+
arguments << QString("-vf");
172+
arguments << QString("scale=trunc(iw/2)*2:trunc(ih/2)*2");
186173

187174
arguments << savePath;
188175
}

0 commit comments

Comments
 (0)