can you read H265/HEVC file using VideoCapture? With OpenCV 3.1. [closed]
Added x265 codec to ffmpeg in OpenCV 3.1 environment.
I am trying to read a file with Video Capture, but when looking at frame, there is only 8 bits of RGB information. Since it is an H265 file, I was expecting to get 10 bits of RGB.
Could you tell me whether the method or procedure you are getting with H265 is wrong?
[code]
VideoCapture video = new VideoCapture;
video.Open(filename);
if(!video.isOpened())
return -1;
video->get(CAP_PROP_POS_FRAMES);
cv::Mat frame(size,size,CV_64FC3);
video >> frame;
if(!frame.ptr() == NULL)
return -1;
//Video.get FOURCC is "hvc1"
//video.get FORMAT is 0
//frame.type = 16(CV_8UC3)
HEVC does not automatically equal 10 bits. At the moment, I don't think there are very many 10-bit HEVC sources. As far as I know, the only hardware encoders that do it is NVIDIA Pascal and 7th gen Intel, and even most of the software ones don't.
You sure it's a 10-bit file?
I have no confirmation, but with the content confirmed using MediaInfo
3840 * 2160 (16: 9), at 59.940 (60000/1001) fps, HEVC (Main 10 @ L 5.1 @ High)
Will be displayed. "Main 10" is about 10 bit profile of HEVC, so I think that it is probably 10 bits.
I guess ffmpeg, or at least the part we use, doesn't support it. I know OpenCV can accept 16-bit files, but I don't know what all is happening inside the ffmpeg module.
hmm...I guess it is useless.
As a supplement to the environment, X 265 in ffmpeg is set by turning HIGH_BIT_DEPTH ON, Main 12 ON, Other defaults. After making it, I build OpenCV 3.1 and run it on QT.
If no one knows, it probably corresponds only to 8bit output. Since I use OpenCV, I will draw images directly from x265.