[Cin] The best strategy to render yuv (mpeg, limited range) from yuvj (jpeg, full range)?

Andrew Randrianasulu randrianasulu at gmail.com
Wed Aug 28 20:39:52 CEST 2024


ср, 28 авг. 2024 г., 20:27 Tarantas via Cin <cin at lists.cinelerra-gg.org>:

> On Wed, 28 Aug 2024 02:35:56 +0300
> Andrew Randrianasulu <randrianasulu at gmail.com> wrote:
>
> > >  - JPEG in "preferences";
> >
> > Unfortunately, this setting controls both input and output color range
> > (swscaler, part of ffmpeg).
>
> By the way, do "F_" video filters works with 32-float RGB?
> It looks like they do, but I'm not sure.
>

as far as I understand ffmpeg filters themselves does not do fp 32bit
filtering ... so it converted to 16bit per channel stage buffer, see
cinelerra/pluginfclient.C and function in cinelerra/ffmpeg.C

AVPixelFormat FFVideoConvert::color_model_to_pix_fmt(int color_model)
                        {
                                                        switch( color_model
) {
    case BC_YUV422:         return AV_PIX_FMT_YUYV422;
                           case BC_RGB888:         return
AV_PIX_FMT_RGB24;                                                   case
BC_RGBA8888:       return AV_PIX_FMT_RGBA;
                  case BC_BGR8888:        return AV_PIX_FMT_BGR0;
                                          case BC_BGR888:         return
AV_PIX_FMT_BGR24;                                                   case
BC_ARGB8888:       return AV_PIX_FMT_ARGB;
                  case BC_ABGR8888:       return AV_PIX_FMT_ABGR;
                                          case BC_RGB8:           return
AV_PIX_FMT_RGB8;                                                    case
BC_YUV420P:        return AV_PIX_FMT_YUV420P;
                   case BC_YUV422P:        return AV_PIX_FMT_YUV422P;
        case BC_YUV444P:        return AV_PIX_FMT_YUV444P;
                               case BC_YUV411P:        return
AV_PIX_FMT_YUV411P;
        case BC_RGB565:         return AV_PIX_FMT_RGB565;
                                case BC_RGB161616:      return
AV_PIX_FMT_RGB48LE;                                                 case
BC_RGBA16161616:   return AV_PIX_FMT_RGBA64LE;
                  case BC_AYUV16161616:   return AV_PIX_FMT_AYUV64LE;
                                          case BC_GBRP:           return
AV_PIX_FMT_GBRP;
default: break;
                        }


and for ffmpeg's colorspace filter it advertizes

{ "format",   "Output pixel format",
                         OFFSET(user_format), AV_OPT_TYPE_INT,  { .i64 =
AV_PIX_FMT_NONE },                                 AV_PIX_FMT_NONE,
AV_PIX_FMT_GBRAP12LE, FLAGS, .unit = "fmt" },
     ENUM("yuv420p",   AV_PIX_FMT_YUV420P,   "fmt"),
                            ENUM("yuv420p10", AV_PIX_FMT_YUV420P10,
"fmt"),
ENUM("yuv420p12", AV_PIX_FMT_YUV420P12, "fmt"),
                        ENUM("yuv422p",   AV_PIX_FMT_YUV422P,   "fmt"),
    ENUM("yuv422p10", AV_PIX_FMT_YUV422P10, "fmt"),
    ENUM("yuv422p12", AV_PIX_FMT_YUV422P12, "fmt"),
                            ENUM("yuv444p",   AV_PIX_FMT_YUV444P,   "fmt"),
    ENUM("yuv444p10", AV_PIX_FMT_YUV444P10, "fmt"),
    ENUM("yuv444p12", AV_PIX_FMT_YUV444P12, "fmt"),


I can't see floating-point formats here ....

 ffmpeg/libavfilter/vf_colorspace.c



> > So I think you need to put some kind of filter either doing full-range
> > -> limited range on input media,
> > or full range-> limited range for whole file on output ....
>
> For now figured out this way:
>  - in render options, "color_range=mpeg";
>  - at the top of ready project - "F_colorspace" filter.
> Interestingly enough the native "ColorSpace" filter doesn't work
> properly and cuts the dynamic range not where it supposed to. I don't
> know why. This deserve a bug report.
>

well, file it then ?



> But this way with the extra filter sucks. You could forgot about it and
> receive the result with an increased contrast. You could forgot about
> it being enabled and wonder why your histogram tweaking doesn't work.
>

you can try to chain cingg's video output to external ffmpeg binary via y4m
filetype, but then you need separate pass for audio ....

Historically cinelerra  was avoiding making decisions for users, may be
partially because making everything fully automatic and working in all
cases is not really trivial ?


> Wait, could I just type "vf=colorspace" into render settings?..
>

never tried that .....

-- 
> Cin mailing list
> Cin at lists.cinelerra-gg.org
> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240828/021d397b/attachment.htm>


More information about the Cin mailing list