Video Writer always uses YUV420P to write raw videos (Bug #782)
Description
When I am trying to add images to an uncompressed AVI file, the VideoWriter always uses the YUV420P+H263 format. However my intention is to generate the Gray8+Raw format.
Later I figured out the problem that the switch (codec_id) goes to the default "PIX_FMT_YUV420P". Please refer to the following code.
/********* cap_ffmpeg.cpp @ line 1267 ***/
case CODEC_ID_RAWVIDEO:
default:
// good for lossy formats, MPEG, etc.
codec_pix_fmt = PIX_FMT_YUV420P;
break;
/**********************************************/
It works fine, when I change the code as below.
/************* cap_ffmpeg.cpp *******/
case CODEC_ID_RAWVIDEO:
codec_pix_fmt = input_pix_fmt;
break;
default:
// good for lossy formats, MPEG, etc.
codec_pix_fmt = PIX_FMT_YUV420P;
break;
/*******************************************/
Associated revisions
use original image type (8-bit grayscale or 24-bit RGB) in the case of RAW video (ticket #782)
Merge pull request #782 from taka-no-me:bitness_detection
History
Updated by Martin Beckett about 14 years ago
Confirmed, fix works with fourcc=Y800 and a CV_8UC1 image
(opencv2.2 vs2010, win7)
Updated by Vadim Pisarevsky over 13 years ago
thanks! the patch has been applied in r5569
- Status changed from Open to Done
- (deleted custom field) set to fixed
Updated by Andrey Kamaev over 12 years ago
- Category changed from highgui-images to highgui-video