Skip to content

Commit

Permalink
Merge pull request #371 from SuslikV/lossless-color-format
Browse files Browse the repository at this point in the history
Use non-subsampled color format for lossless encoding with the h264 encoder
  • Loading branch information
jonoomph committed Sep 10, 2020
2 parents ce491a0 + aac27d5 commit 6cc00d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/FFmpegUtilities.h
Expand Up @@ -122,6 +122,9 @@
#ifndef PIX_FMT_YUV420P
#define PIX_FMT_YUV420P AV_PIX_FMT_YUV420P
#endif
#ifndef PIX_FMT_YUV444P
#define PIX_FMT_YUV444P AV_PIX_FMT_YUV444P
#endif

// FFmpeg's libavutil/common.h defines an RSHIFT incompatible with Ruby's
// definition in ruby/config.h, so we move it to FF_RSHIFT
Expand Down
2 changes: 2 additions & 0 deletions src/FFmpegWriter.cpp
Expand Up @@ -438,6 +438,7 @@ void FFmpegWriter::SetOption(StreamType stream, std::string name, std::string va
av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value), 51), 0); // 0-51
if (std::stoi(value) == 0) {
av_opt_set(c->priv_data, "preset", "veryslow", 0);
c->pix_fmt = PIX_FMT_YUV444P; // no chroma subsampling
}
break;
case AV_CODEC_ID_HEVC :
Expand Down Expand Up @@ -498,6 +499,7 @@ void FFmpegWriter::SetOption(StreamType stream, std::string name, std::string va
av_opt_set_int(c->priv_data, "crf", std::min(std::stoi(value), 51), 0); // 0-51
if (std::stoi(value) == 0) {
av_opt_set(c->priv_data, "preset", "veryslow", 0);
c->pix_fmt = PIX_FMT_YUV444P; // no chroma subsampling
}
break;
case AV_CODEC_ID_HEVC :
Expand Down

0 comments on commit 6cc00d6

Please sign in to comment.