Color changes after video to single frame images back to video using ffmpeg Given master video in mov rle:

Video: qtrle (rle  / 0x20656C72), rgb24(progressive)


Converted the video to a serie of single .bmp frames. 

ffmpeg -i source.mov $FRAMES/f%03d.bmp


Frames from unchanged parts I recompiled to mpeg ts intermediate files:

ffmpeg                   \
-framerate 25            \
-start_number $i         \
-i "$FRAMES/f%03d.bmp"   \
-vframes $n              \
-c:v libx264rgb          \ # libx264
  -preset slow           \
  -tune animation        \
  -crf 20                \
  -pix_fmt rgb24         \ # yuv420p 
-bsf:v h264_mp4toannexb  \
-f mpegts                \
-y -an -hide_banner      \
"$FOLDER_TS/_${i}_${o}.ts"


To other part of the clip I applied filters like pad, zoompan, format. Overlaid PNG with transparency, animated. Output to the same format h264 .ts

Concat the .ts parts to mp4 movie file.

Color seems to have changed a little. Can be noticed when joining source movie with the processed one.

What stage of the process could affect the slight changes in colors?

Is it the pixel format conversion or BMP format usage?

How to convert movie file to sinlge frame images preserving exact color?
Solved the problem by setting colormatrix conversion using swscale lib. Added to my filter chain:

scale=in_color_matrix=bt601:out_color_matrix=bt709


and

-colorspace bt709


to the output.



References


ffmpeg scale filter
ffmpeg colormatrix filter
colorspace on ffmpeg wiki
question on video.stackexchange




Credits

Found the advice on VideoHelp forum reply from 2017, which in turn references the question on this video.stackexchange.  Thanks again, Gyan!