0

So I've figured out how to convert images to prores with no colorspace shifts using either:

-vf colormatrix=bt601:bt709 filter for 8bit material

and

-vf colorspace=all=bt709:range=pc:format=yuv444p10:iall='bt601-6-625':irange=pc filter for 8bit or 10bit material.

However, whenever I use colormatrix or colorspace filters the output file contains no alpha channel. As soon as I remove these filters the alpha channel is present but now I've got a color shift.

#this generates no alpha
ffmpeg -f image2 -r 24.0 -i tif_w_alpha.%3d.tif -c:v prores_ks -profile:v 5 -pix_fmt yuva444p10le -vf colorspace=all=bt709:range=pc:format=yuv444p10:iall='bt601-6-625':irange=pc -alpha_bits 16 this_has_no_alpha_channel.mov

#this has alpha but also a color shift
ffmpeg -f image2 -r 24.0 -i tif_w_alpha.%3d.tif -c:v prores_ks -profile:v 5 -pix_fmt yuva444p10le -alpha_bits 16 this_has_alpha.mov

This behavior is the same in both -profile:v 4 and 5 which are the only 2 that support alpha. How can I get the color filter to work without losing the alpha channel?

0

1 Answer 1

1

The colorspace and colormatrix filters don't handle alpha pixel formats, so those get stripped off. The workaround is to extract the alpha and then reattach it.

ffmpeg -f image2 -framerate 24.0 -i tif_w_alpha.%3d.tif -filter_complex "[0]colorspace=all=bt709:range=pc:format=yuv444p10:iall='bt601-6-625':irange=pc[main];[0]alphaextract,format=gray10le[alpha];[main][alpha]alphamerge" -c:v prores_ks -profile:v 5 -pix_fmt yuva444p10le -alpha_bits 16 this_has_no_alpha_channel.mov

BTW, The Quicktime specification doesn't accommodate output range pc. Consumers should expect to treat range as always tv. If your software allows to override that, nice, but other software may not.

9
  • Thanks. Not using quicktime for this data. The software I will be using handles it fine. Not sure you can even do anything with alpha inside the quicktime app.
    – Shao Zhang
    Commented Aug 6, 2019 at 14:32
  • Got it working, thanks!
    – Shao Zhang
    Commented Aug 6, 2019 at 16:26
  • Why did you change the filter ordering?
    – Gyan
    Commented Aug 6, 2019 at 16:38
  • The ordering you originally posted caused my encode to hang on the last frame. Killing the process just produced a corrupt file. Switching the ordering fixed it and produced a correct color and alpha prores file.
    – Shao Zhang
    Commented Aug 6, 2019 at 17:19
  • That should not make a difference. Share full log.
    – Gyan
    Commented Aug 6, 2019 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.