Working on some video stuff.
Encoding sRGB data in PPM files to yuv420p x264 mkv with ffmpeg and back to PNG looks ok. There is no colour space information recorded in the mkv afaict, so maybe other decoders will guess at different colours...
Encoding REC.709 YUV raw data to yuv240p/bt709 mkv with x264 command line, specifying which colour matrices and transfer functions etc to use, ffmpeg decodes it to something with bad/shifted colours (too dark). This is probably to do with transfer functions; either from bt709 to linear YUV, or from linear RGB to sRGB, or both (probably both).
MPlayer output to PNG on Debian Buster is broken somehow at the moment so I can't test if decoding is the issue, haven't figured out how to get (C)VLC to output to image files either. MPV uses ffmpeg internally so that's no good for testing, even though it works with `--vo image`.
4:2:0 chroma subsampling explained (see diagram).
Interpretation of symbols
Luma sample position indications:
Luma sample top field
Luma sample bottom field
Chroma sample position indications, where grey fill indicates a bottom field
sample type and no fill indicates a top field sample type:
Chroma sample type 2 Chroma sample type 3
Chroma sample type 0 Chroma sample type 1
Chroma sample type 4 Chroma sample type 5
Figure E-1 – Location of chroma samples for top and bottom fields for chroma_format_idc equal to 1 (4:2:0
chroma format) as a function of chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field
Welcome to post.lurk.org, an instance for discussions around cultural freedom, experimental, new media art, net and computational culture, and things like that.