Why the image's color is difference when use VLC and OpenCV to open same video or image

My OpenCV code is:
import cv2
cap = cv2.VideoCapture(‘1.avi’)
capturer.set(cv2.CAP_PROP_POS_FRAMES, 5049)
cv2.namedWindow(“test”, 0)
cv2.resizeWindow(“test”, 800, 600)
ret, video_frame = capturer.read()
cv2.imshow(“test”, video_frame)
if cv2.waitKey(1):

Use VLC open the same video and locate to same frame, the color is different:

How to solve, please help!

same problem without the resize() ?

I don’t see a problem with color. the pictures look identical to me.

if you see a difference, please point it out. provide pictures that have the same exact size.

also: yes VLC and ffmpeg use different decoders, AND they may have to guess the color space of the video (if it’s not said in the video’s metadata). and if those color spaces are different, the result will look slightly different.

For me colors are the sames.

I have faced this problem before and it had two possible causes: different codec used by VLC versus OpenCV, or because VLC somehow “normalizes” the image before display. Exact problem was not clear to me.

1 Like