I have an animation rendered as a series of png images, and I want to convert it losslessly into an H.264 mp4 video. The images are in the RGB color space.
I tried these options:
ffmpeg -framerate 24 -i "animation.%04d.png" -c:v libx264 -preset veryslow -tune animation -crf 0 "test video.mp4"
But the output file had messed up colors, possibly because of an improper RGB to YUV conversion.
Then I tried these options:
ffmpeg -framerate 24 -i "animation.%04d.png" -c:v libx264rgb -preset veryslow -tune animation -crf 0 "test video.mp4"
The quality of the output video file was the same as that of the original png images, that is the encoding was indeed lossless, but the output file was encoded in the RGB color space, and thus it is not compatible with video editing software (such as Avidemux, I did not test other programs, but I suppose it will be the same).
How do I resolve this?
Is there a way to improve the RGB to YUV conversion, or even to make it lossless?
Or is there a way to improve the compatibility of RGB encoded videos?
-pix_fmt yuv444p
to store without chroma subsampling, but that'll still not be lossless (i.e. a non-reversible color transform).