I want to change some pixels of some frames, I do this steps:
1 - Extract frames from FLV video to PNG
2 - Change frame pixels color ,For example I set color of Pixel(0,0) to ARGB (0,0,0,0)
3 - Encode frames to a video by below code:
-i Frame%04d.png -filter_complex "[0:0] scale= [wm]; [wm][1:0] overlay=1:1 [out]" -map "[out]" -map 0:a -c:v libx264 -vprofile low outfile.flv
But when I check "outfile.flv" frames , pixel 0,0 is 255,7,2,3 instead of 0,0,0,0 , why? Please tell me that how can I get same pixels color after encode?
Video compression is a lossy process. To make the files smaller, an encoder will find areas of the image where it believes complexity can be removed without a difference that is perceivable by the human eye. You can use a lossless compression (by setting the quantizer to 0), but you would need to confirm that encoder is not performing a color space conversion as they are not perfectly reversible in most cases. And if you do uses a lossless compression, and color conversion, your final file size will be very large.