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

Phyllis Smith phylsmith2017 at gmail.com
Mon Sep 2 02:28:54 CEST 2024


Tarantas, thank you very much for working through a solution for this issue
and providing the "real world" example.   Andrea, thank you for the Latex
version for the manual which has been checked into GIT and will appear in
the September 30th manual.  As usual, I changed a few trivial things; for
example "loose" to "lose".

On Fri, Aug 30, 2024 at 4:39 PM Tarantas via Cin <cin at lists.cinelerra-gg.org>
wrote:

> On Thu, 29 Aug 2024 22:12:38 +0000
> Andrea paz <gamberucci.andrea at gmail.com> wrote:
>
> > I don't think YT skips color compression if set directly as YT wants
> > it. Anyway it's a complicated and interesting topic and if you do
> > tests and find an optimal solution please let me know and I'll put it
> > in the manual.
>
> Well, here's my draft if I would write such a manual.
>
> """
> Title: [the subject of this thread actually]
>
> For a historical reasons, almost every piece of video software uses
> limited range [...]
>
> But, sometimes you have to deal with files encoded utilizing the full
> range. For example, some video cameras encode full range files. The
> simplest way to deal with them is just to re-encode in limited range:
>
>   ffmpeg -i input.mp4 -c:v libx264 -preset fast -crf 19 -c:a copy \
>     -pix_fmt yuv420p output.mp4
>
> But, this is not an option for you if you're either a perfectionist or
> trying to fight color banding.
>
> Color banding is a video artifact that could be visible in smooth areas
> of the video.
> Here's an example: https://youtu.be/KL8CIZej19o
> If you don't see the ugly background, then you don't need to worry
> about the whole issue.
>
> Color banding is different from compression artifacts. You can't fight
> it just by increasing the bitrate of your video.
>
> Color banding comes from color correction performed too much or in
> inaccurate way. And it stacks, so if you faced it, then you should get
> rid of dynamic range compression at every step it happens.
>
> Cinelerra has a native full color range support, and you can enable it
> via:
> Settings -> Preferences -> Appearance -> YUV color range: JPEG
> Note how everything will loose contrast and become grey-ish.
>
> But, in this mode, Cinelerra will also render full range video files.
> There are two reasons why it could be a bad thing:
>  - some video players don't understand what full range is and will play
>    these resulting videos with the increased contrast;
>  - some image processing software (like YouTube) will re-encode full
>    range videos into limited range by compressing the dynamic range and
>    making the color banding issue even worse.
>
> That's why you should make a couple of hacks.
> First, after your project is done, apply F_colorspace filter at the end
> (bottom) of the stack with these options:
>  - range: 1
>  - irange: 2
> Second, in File -> Render -> Video, place this line at the end of big
> textfield:
>   color_range=mpeg
>
> Since you're already fighting color banding, the good thing is to
> 32-bit colors in Settings -> Format -> Color model: RGB(A)-FLOAT.
> Note this could slow down your playback and rendering.
> """
>
> By the way, if anyone is wondering "why is this guy so obsessed with
> such a rare issue" - well, I shoot blurry asphalt, usually misexposed:
> https://www.youtube.com/watch?v=B6QukURw_Og
> This was the good example where I was clever and minimized the damage.
> I have worse and don't want to look at them.
>
> By the way^2 - I just notice the cinelerra manual is the first result
> for googling "mpeg color range". Cool!
>
> > However, this is a different matter from what you were asking. You
> > could try using ffmpeg from the command line using the option:
> > -vf "scale=in_range=jpeg:out_range=mpeg" -pix_fmt yuv420p
> > and compare with the result obtained in CinGG to see if there are any
> > differences.
> >
> > Question: In CinGG, what format and preset do you use for the
> > rendering to export to YT?
>
> Nothing fancy really.
>
> File -> Render:
>   File format: FFMPEG mp4
>   Audio:
>     bitrate 0,
>     quality 5 (an overkill really, produces ~450 kbit/s AAC, but it's
>                still noting compared to video)
>   Video:
>     bitrate 0,
>     quality -1,
>     pixels yuv420p,
>     in a big field for options:
>       crf=25 (for a 4K, must be lower for 1080p)
>       preset=fast
>
> This provides a nice gently compressed video for long-time storing and
> uploading to YouTube.
> --
> 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/20240901/830e82e6/attachment.htm>


More information about the Cin mailing list