Finally makes MPlayer screenshots have correct colors and luma
range all the way through.
bitstream_put_ui(bs, 1, 1); /* video_signal_type_present_flag */
{
bitstream_put_ui(bs, 5, 3); /* video_format (5 = Unspecified) */
bitstream_put_ui(bs, 1, 1); /* video_signal_type_present_flag */
{
bitstream_put_ui(bs, 5, 3); /* video_format (5 = Unspecified) */
- bitstream_put_ui(bs, 1, 1); /* video_full_range_flag */
+ bitstream_put_ui(bs, 0, 1); /* video_full_range_flag */
bitstream_put_ui(bs, 1, 1); /* colour_description_present_flag */
{
bitstream_put_ui(bs, 1, 8); /* colour_primaries (1 = BT.709) */
bitstream_put_ui(bs, 1, 8); /* transfer_characteristics (1 = BT.709) */
bitstream_put_ui(bs, 1, 1); /* colour_description_present_flag */
{
bitstream_put_ui(bs, 1, 8); /* colour_primaries (1 = BT.709) */
bitstream_put_ui(bs, 1, 8); /* transfer_characteristics (1 = BT.709) */
- bitstream_put_ui(bs, 1, 8); /* matrix_coefficients (1 = BT.709) */
+ bitstream_put_ui(bs, 6, 8); /* matrix_coefficients (6 = BT.601/SMPTE 170M) */
}
}
bitstream_put_ui(bs, 0, 1); /* chroma_loc_info_present_flag */
}
}
bitstream_put_ui(bs, 0, 1); /* chroma_loc_info_present_flag */
// mux, this might simply get ignored. See sps_rbsp().
avstream_video->codec->color_primaries = AVCOL_PRI_BT709; // RGB colorspace (inout_format.color_space).
avstream_video->codec->color_trc = AVCOL_TRC_BT709; // Gamma curve (inout_format.gamma_curve).
// mux, this might simply get ignored. See sps_rbsp().
avstream_video->codec->color_primaries = AVCOL_PRI_BT709; // RGB colorspace (inout_format.color_space).
avstream_video->codec->color_trc = AVCOL_TRC_BT709; // Gamma curve (inout_format.gamma_curve).
- avstream_video->codec->colorspace = AVCOL_SPC_BT709; // YUV colorspace (output_ycbcr_format.luma_coefficients).
- avstream_video->codec->color_range = AVCOL_RANGE_JPEG; // Full vs. limited range (output_ycbcr_format.full_range).
+ avstream_video->codec->colorspace = AVCOL_SPC_SMPTE170M; // YUV colorspace (output_ycbcr_format.luma_coefficients).
+ avstream_video->codec->color_range = AVCOL_RANGE_MPEG; // Full vs. limited range (output_ycbcr_format.full_range).
avstream_video->codec->chroma_sample_location = AVCHROMA_LOC_LEFT; // Chroma sample location. See chroma_offset_0[] in Mixer::subsample_chroma().
avstream_video->codec->field_order = AV_FIELD_PROGRESSIVE;
avstream_video->codec->chroma_sample_location = AVCHROMA_LOC_LEFT; // Chroma sample location. See chroma_offset_0[] in Mixer::subsample_chroma().
avstream_video->codec->field_order = AV_FIELD_PROGRESSIVE;
// happens in a pass not run by Movit (see Mixer::subsample_chroma()).
output_ycbcr_format.chroma_subsampling_x = 1;
output_ycbcr_format.chroma_subsampling_y = 1;
// happens in a pass not run by Movit (see Mixer::subsample_chroma()).
output_ycbcr_format.chroma_subsampling_x = 1;
output_ycbcr_format.chroma_subsampling_y = 1;
- output_ycbcr_format.luma_coefficients = YCBCR_REC_709;
- output_ycbcr_format.full_range = true;
+
+ // Rec. 709 would be the sane thing to do, but it seems many players
+ // (e.g. MPlayer and VLC) just default to BT.601 coefficients no matter
+ // what (see discussions in e.g. https://trac.ffmpeg.org/ticket/4978).
+ // We _do_ set the right flags, though, so that a player that works
+ // properly doesn't have to guess.
+ output_ycbcr_format.luma_coefficients = YCBCR_REC_601;
+ output_ycbcr_format.full_range = false;
output_ycbcr_format.num_levels = 256;
chain->add_ycbcr_output(inout_format, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED, output_ycbcr_format, YCBCR_OUTPUT_SPLIT_Y_AND_CBCR);
output_ycbcr_format.num_levels = 256;
chain->add_ycbcr_output(inout_format, OUTPUT_ALPHA_FORMAT_POSTMULTIPLIED, output_ycbcr_format, YCBCR_OUTPUT_SPLIT_Y_AND_CBCR);