can you read H265/HEVC file using VideoCapture? With OpenCV 3.1. [closed]

asked 2017-01-10 01:12:41 -0600

misoni112 gravatar image

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)

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by misoni112
close date 2017-01-11 18:01:42.070831

Comments

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?

Tetragramm gravatar imageTetragramm ( 2017-01-10 20:55:26 -0600 )edit

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.

misoni112 gravatar imagemisoni112 ( 2017-01-10 21:38:47 -0600 )edit

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.

Tetragramm gravatar imageTetragramm ( 2017-01-10 21:53:17 -0600 )edit

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.

misoni112 gravatar imagemisoni112 ( 2017-01-10 23:30:50 -0600 )edit

If no one knows, it probably corresponds only to 8bit output. Since I use OpenCV, I will draw images directly from x265.

misoni112 gravatar imagemisoni112 ( 2017-01-11 18:00:59 -0600 )edit