Message ID | tencent_50928899664BBF6E6534B15DD9C1137A0F05@qq.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] libavformat/riffenc: handle gray8 format for uncompressed avi | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Thu, Aug 19, 2021 at 12:07:33PM +0800, rui.jiang wrote: > add palette data in avi header when the input data is raw gray8 pixel data and the output data is 8bit uncompressed avi video > > Signed-off-by: rui.jiang <229135609@qq.com> > --- > libavformat/riffenc.c | 9 +++++++++ > 1 file changed, 9 insertions(+) breaks rawvideo in ffv1 ./ffmpeg -f rawvideo -framerate 2 -s 192x144 -pix_fmt gray -i video.raw -vcodec ffv1 -y test.avi && ./ffmpeg -i test.avi -f null - ... [ffv1 @ 0x5636115c9f40] Invalid version in global header Stream mapping: Stream #0:0 -> #0:0 (ffv1 (native) -> wrapped_avframe (native)) Error while opening decoder for input stream #0:0 : Invalid data found when processing input [...]
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index 43c8bf957a..d8b767787f 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -266,6 +266,15 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, else avio_wl32(pb, 0); } + } else if (pix_fmt == AV_PIX_FMT_GRAY8) { + /* Initialize 8 bpp palette */ + int i; + for (i = 0; i < 256; i++) { + avio_w8(pb,i); + avio_w8(pb,i); + avio_w8(pb,i); + avio_w8(pb,0); + } } } }
add palette data in avi header when the input data is raw gray8 pixel data and the output data is 8bit uncompressed avi video Signed-off-by: rui.jiang <229135609@qq.com> --- libavformat/riffenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)