[Ffmpeg-devel] VIDEO_PALETTE_RGB565 format support
yi li
liyi.dev
Sat Apr 28 09:46:43 CEST 2007
Hi,
I am trying to grab video from a camera sensor with output format
VIDEO_PALETTE_RGB565, but ffmpeg looks does not support this format. I
change libavformat/grab.c as bellow, ffmpeg can be started, but the color of
the grabbed video is not correct. Could anyone give some suggestions?
--- ../../ffmpeg_svn/ffmpeg/libavformat/grab.c 2007-04-13 12:24:
45.000000000 +0800
+++ libavformat/grab.c 2007-04-28 14:49:13.000000000 +0800
@@ -174,8 +174,13 @@
pict.palette=VIDEO_PALETTE_GREY;
pict.depth=8;
ret = ioctl(video_fd, VIDIOCSPICT, &pict);
- if (ret < 0)
- goto fail1;
+ if (ret < 0) {
+ pict.palette=VIDEO_PALETTE_RGB565;
+ pict.depth=16;
+ ret = ioctl(video_fd, VIDIOCSPICT, &pict);
+ if (ret < 0)
+ goto fail1;
+ }
}
}
}
@@ -266,6 +271,10 @@
frame_size = width * height * 1;
st->codec->pix_fmt = PIX_FMT_GRAY8;
break;
+ case VIDEO_PALETTE_RGB565:
+ frame_size = width * height * 2;
+ st->codec->pix_fmt = PIX_FMT_RGB565;
+ break;
default:
goto fail;
}
Thanks a lot,
-Yi
More information about the ffmpeg-devel
mailing list