i want to use ffmpeg to convert a video which with yuv420p10le(bt2020) to yuv420p(bt709), but the encoded video's color isn't correct compare to the original video
[Attachment 72889 - Click to enlarge]
this is the original video
[Attachment 72890 - Click to enlarge]
this is the encoded video
my command is add -pix_fmt:v yuv420p -colorspace:v 'bt709' -color_primaries:v 'bt709' -color_trc:v 'bt709' -color_range:v 'tv' flags to ffmpeg.
so how can i do with ffmpeg can do this conversion?
+ Reply to Thread
Results 1 to 18 of 18
-
-
Search for HDR to SDR with tonemap.
Can be done with clever Ffmpeg-GUI.
[Attachment 72894 - Click to enlarge]
In this example the source HDR is resized to 1280x720 and encoded with h264 (avc).
Use the newest beta (v3.1.3.01) for this.Last edited by ProWo; 4th Aug 2023 at 02:38.
-
-
sorry i know this error is because my ffmpeg doesn't support libzimg2, so i compiled ffmpeg with libzimg2, and it works!
and now i want to apply this filter under nvidia gpu, so i try
Code:./ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i UPL_1vKBpdd4iX_slice.mp4 -vf hwdownload,format=p010le,format=nv12,hwupload,scale_npp=format=yuv420p,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=709,tonemap=hable:desat=2,zscale=t=709:m=709:r=tv,format=yuv420p -c:v h264_nvenc output.mp4
-
-
-
-
Referred to And yes - zscale is not GPU accelerated but it is quite fast - (for example faster than native to ffmpeg own scale and at the same time provide higher quality).
During transcode you have three basic steps, 1-st decode - this can be performed by HW, then processing - 2-nd processing and if zscale is used then CPU must be involved and 3-rd step is encoding - also can be performed by HW - usually 3-rd one is most computationally intensive and using HW acceleration is the most beneficial.
FFmpeg offer HW accelerated filter for tone mapping https://ffmpeg.org/ffmpeg-filters.html#tonemap_005fopencl - example of its usage is in https://superuser.com/questions/1549479/ffmpeg-4k-hdr-to-1080p-sdr-hardware-tonemap-co...version-opencl - so you need to combine HW decoding with HW tone mapping and HW encoding (my assumption based on your other threads).
Another possibility is to use https://ffmpeg.org/ffmpeg-filters.html#libplacebo for tone mapping -
yeah this is a good idea, but i don't know how to do this in one command, i try
./ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i UPL_1vKBpdd4iX_slice.mp4 -vf hwdownload,format=p010le,format=nv12,hwupload,scal e_npp=format=yuv420p,zscale=t=linear:npl=100,forma t=gbrpf32le,zscale=p=709,tonemap=hable:desat=2,zsc ale=t=709:m=709:r=tv,format=yuv420p -c:v h264_nvenc output.mp4
but seems zscale can't parse cuda's output, so i don't know how can do that you mentioned -
As i don't have NVidia HW then i can't support you but i can tell what in my opinion you can do: first simplify command - try to remove unnecessary format conversion, at second i would try to play with zscale - sadly it doesn't report supported pixel formats (this is serious ffmpeg error i believe but this inconsistency in ffmpeg is quite common). Alternatively use HW accelerated tone mapping - examples are provided in libplacebo and tonemap_opencl .
-
Similar Threads
-
Footage looks too dark. Any way to color correct it?
By Sunk in forum Capturing and VCRReplies: 76Last Post: 16th Jul 2023, 15:39 -
color space bt709 to bt2020, but the player display color is different
By KaGaWu in forum Newbie / General discussionsReplies: 5Last Post: 14th Feb 2023, 03:43 -
[HELP] Correct color space
By darkslayer00 in forum DVD RippingReplies: 1Last Post: 29th Nov 2021, 02:59 -
apply gamma and colorspace conversion to match original .mov using ffmpeg
By Drinkitrinki in forum Video ConversionReplies: 18Last Post: 25th May 2020, 16:09 -
ffmpeg yuv colorspace is BT.601 or BT.709?
By colibri in forum Newbie / General discussionsReplies: 13Last Post: 22nd Dec 2019, 01:00