Hi everyone, I'm trying to implement a new pixel format in FFmpeg but it appears that my implementation is not correct. Indeed, when I do a ffplay on a raw video in this new pixel format, the output is not correct.
The pixel format I want to implement is the uyvy422i12le. Data y, u and v are stored in the same buffer, in this interlaced way : u0, y0, v0, y1, u1, y2, v1, y3, u2, y4, v2, y5, ..., each data is encoded on 12 bits and stored on 16 bits Little Endian. For adding this new pix_fmt, I have done the following modifications : - in libavutil/pixfmt.h, add "AV_PIX_FMT_UYVY422I12LE" in enum AVPixelFormat - in libavutil/pixdesc.c, add AV_PIX_FMT_UYVY422I12LE in av_pix_fmt_descriptors : [AV_PIX_FMT_UYVY422I12LE] = { .name = "uyvy422i12le", .nb_components = 3, .log2_chroma_w = 1, .log2_chroma_h = 0, .comp = { { 0, 4, 2, 0, 12, 3, 11, 3 }, /* Y */ { 0, 8, 0, 0, 12, 7, 11, 1 }, /* U */ { 0, 8, 4, 0, 12, 7, 11, 5 }, /* V */ - in libswscale/utils.c, add "[AV_PIX_FMT_UYVY422I12LE]= { 1, 1 }," in format_entries Once FFmpeg compiled with these modifications, if a do a ffplay on a raw image in uyvy422i12le, I have this output which is uncorrect : https://ibb.co/g7jG3ss Here's the command line and the output : ./ffplay -f rawvideo -video_size 3840x2160 -pixel_format uyvy422i12le test_in ffplay version 48.1 Copyright (c) 2003-2019 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 [rawvideo @ 0x7f47bc000940] Estimating duration from bitrate, this may be inaccurate Input #0, rawvideo, from 'test_in': Duration: 00:00:00.04, start: 0.000000, bitrate: 6635520 kb/s Stream #0:0: Video: rawvideo, uyvy422i12le, 3840x2160, 6635520 kb/s, 25 tbr, 25 tbn, 25 tbc 1.87 M-V: -0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 you can found the original image here : https://ibb.co/zZrvt5K (colorimetry is strange but that's normal it's an HDR content). It looks like I have set bad values in the struct AVComponentDescriptor of AV_PIX_FMT_UYVY422I12LE, but I do not see which one... Or have I forgotten to add other modifications necessary to a new pixel format ? The FFmpeg used is from tag n.42 of the FFmpeg 's official repo. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".