# Lossless 10-bit colorspace (yuvj420p) video output

Using GoPro footage which are in 10-bit color space (yuvj420p), and using Blender as a video editor, the output seems to always be in 8-bit color space.

How can I preserve the 10-bit color space?

Tried:

• Output: AVI RAW
• Output: H.264 + Encoding Format: H.264 + [X] Lossless
• Output: H.264 + Encoding Format: AVI + Codec: H.264 + [X] Lossless
• Output: H.264 + Encoding Format: Quicktime + Codec: H.264 + [X] Lossless
• Output: H.264 + Encoding Format: AVI + Codec: HuffYUV
• Float color space in sequencer

No matter these, in the end ffprobe always shows it's not anymore in yuvj420p but in yuv420p (or what should be another 8-bit color space format). This results in washed out colors visible on HDR monitors (barely noticeable on older monitors).

Similar questions without good answers yet:

Note: Input video file format (from ffprobe):

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], 8217 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)

• Hmm, I have this dim recollection that the VSE is 8bit. Try enabling each strips color management in properties. – 3pointedit Feb 15 '17 at 23:07
• @3pointedit In Sequencer for the video strip (trying with a single strip) I've enabled Colors: Convert to Float and tried various Input Color. Still having no yuvj420p in the end. – Wernight Feb 15 '17 at 23:21
• The difference between yuvj420p and yuv420p isn't the bit depth, but the range. yuv420p has the range 16-235 whereas yuvj420p has the full range, 0-255. Moreover, your input file is encoded with profile High, which doesn't support 10-bit. You'll need High 10, High 4:2:2 or High 4:4:4 Predictive for 10-bit support. So basically your input seems to be 8-bit, and the colour loss is likely caused by the reduced range rather than by fewer bits. Unfortunately, I don't know how to get the VSE to use yuvj420p, so I won't add this as an answer. – Duane Dibbley Feb 16 '17 at 0:31
• 3PointEdit wins another one; VSE is always 8 BPP. – troy_s Feb 16 '17 at 7:07
• @DuaneDibbley Thanks for clarifying the format. Would you know which lossless codec is likely to have the largest color range? I can always force ffmpeg to use uyvj420p later and that might do the trick. – Wernight Feb 16 '17 at 17:43

You can't.

When working on footage, it is always most prudent to operate on the frame level, with controlled decoding to the file format you choose. Codecs always have been and always will be an awful choice.

Currently in Blender, all codecs via the VSE (and otherwise I believe) are decoded using the FFMPEG call that converts them to an 8 bit buffer.

So, decode outside to a suitable 16 bit container such as TIFF, then properly linearize the results via a controlled transform.

Also, “8 bit” is not a colour space, nor is “10 bit”, nor is “float color space”.

Answering my own question here, it looks like it's possible by rendering as PNG then using:

ffmpeg -framerate 500/21 -i %d.png -i audio.wav -c:v libx264 -crf 0 -pix_fmt yuv422p10le -c:a copy output.mkv