Issue with pix_fmt yuvj444p and libx265

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with pix_fmt yuvj444p and libx265

Samik Some
I am facing a weird issue when encoding images to video in the yuvj444p
format. The colors are off and there are artifacts which look like the
image is enlarged and overlayed on itself. The issue persists if I
extract the frames back from the video. I have providing links to
samples below:

1) https://0x0.st/iybW.png - Original Image
2) https://0x0.st/iyb4.mkv - Image encoded using yuvj444p (1s video with
2 identical frames)
3) https://0x0.st/iybJ.mkv - Image encoded using gbrp

The commands for encoding were:

ffmpeg -f image2 -framerate 1 -i %d.png -pix_fmt yuv444p -c:v libx265
-crf 18 -an a.mkv
ffmpeg -f image2 -framerate 1 -i %d.png -pix_fmt gbrp -c:v libx265 -crf
18 -an b.mkv

As can be seen encoding using yuvj444p causes a wash out and a overlay
effect. Using gbrp works fine. yuv444p also works fine however it limits
the color range.

What could be causing this issue?

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Issue with pix_fmt yuvj444p and libx265

pdr0
You can use -x265-params to pass x265 settings. In this case to specify
input-csp i444.

Personally, I prefer to explicitly control the RGB=>YUV conversion with -vf
scale or zscale

eg.
ffmpeg -r 24 -loop 1 -i iybW.png -vf
scale=out_color_matrix=bt709:out_range=full,format=yuvj444p -c:v libx265
-crf 18 -x265-params input-csp=i444:colormatrix=bt709 -an -t 00:00:01
yuvj444p.mkv






--
Sent from: http://www.ffmpeg-archive.org/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Issue with pix_fmt yuvj444p and libx265

Samik Some
Thank you. This works.

Somewhat related question. Does sws_flags have any effect when
converting to yuvj444p color space using scale? (since no actual
resizing is needed)

On 04/07/20 6:31 am, pdr0 wrote:

> You can use -x265-params to pass x265 settings. In this case to specify
> input-csp i444.
>
> Personally, I prefer to explicitly control the RGB=>YUV conversion with -vf
> scale or zscale
>
> eg.
> ffmpeg -r 24 -loop 1 -i iybW.png -vf
> scale=out_color_matrix=bt709:out_range=full,format=yuvj444p -c:v libx265
> -crf 18 -x265-params input-csp=i444:colormatrix=bt709 -an -t 00:00:01
> yuvj444p.mkv
>
>
>
>
>
>
> --
> Sent from: http://www.ffmpeg-archive.org/
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Issue with pix_fmt yuvj444p and libx265

pdr0
Samik Some wrote
> Somewhat related question. Does sws_flags have any effect when
> converting to yuvj444p color space using scale? (since no actual
> resizing is needed)

Yes. The sws flags are used to control the RGB to YUV conversion. In this
case , full range, and 709 for the matrix conversion

When you specify pix_fmt yuvj444, full range is performed (because of the
"j"), but a 601 conversion by default (wrong colors for "HD"). You can try
it yourself by omitting -vf scale and just using -pix_fmt yuvj444p

The -x265-params colormatrix=bt709 is just a VUI flag; no conversion is done
there . It's just a "label" that other programs, players  might read as
"709" .





--
Sent from: http://www.ffmpeg-archive.org/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".