FFmpeg: Force MP4 files to YUV420P

This commit is contained in:
Vicki Pfau 2017-04-04 02:02:29 -07:00
parent d9b645b209
commit 6a77d2aaea
2 changed files with 9 additions and 0 deletions

View File

@ -82,6 +82,7 @@ Misc:
- Qt: Remove audio buffer sizing in AudioProcessorQt - Qt: Remove audio buffer sizing in AudioProcessorQt
- Qt: Re-enable QtMultimedia on Windows - Qt: Re-enable QtMultimedia on Windows
- FFmpeg: Return false if a file fails to open - FFmpeg: Return false if a file fails to open
- FFmpeg: Force MP4 files to YUV420P
0.5.2: (2016-12-31) 0.5.2: (2016-12-31)
Bugfixes: Bugfixes:

View File

@ -304,6 +304,14 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
} }
av_opt_set(encoder->video->priv_data, "tune", "zerolatency", 0); av_opt_set(encoder->video->priv_data, "tune", "zerolatency", 0);
} }
if (encoder->video->codec->id == AV_CODEC_ID_H264 &&
(strcasecmp(encoder->containerFormat, "mp4") ||
strcasecmp(encoder->containerFormat, "m4v") ||
strcasecmp(encoder->containerFormat, "mov"))) {
// QuickTime and a few other things require YUV420
encoder->video->pix_fmt = AV_PIX_FMT_YUV420P;
}
avcodec_open2(encoder->video, vcodec, 0); avcodec_open2(encoder->video, vcodec, 0);
#if LIBAVCODEC_VERSION_MAJOR >= 55 #if LIBAVCODEC_VERSION_MAJOR >= 55
encoder->videoFrame = av_frame_alloc(); encoder->videoFrame = av_frame_alloc();