VideoHelp Forum




+ Reply to Thread
Results 1 to 18 of 18
  1. 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
    Image
    [Attachment 72889 - Click to enlarge]

    this is the original video
    Image
    [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?
    Quote Quote  
  2. Search for HDR to SDR with tonemap.
    Can be done with clever Ffmpeg-GUI.

    Image
    [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.
    Quote Quote  
  3. Originally Posted by ProWo View Post
    Search for HDR to SDR with tonemap.
    Can be done with clever Ffmpeg-GUI.

    Image
    [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.
    i can't use this GUI, only can use ffmpeg CLI, do you know how to do same thing in CLI?
    Quote Quote  
  4. Originally Posted by slick zheng View Post
    i can't use this GUI, only can use ffmpeg CLI, do you know how to do same thing in CLI?

    Here you go:
    -vf zscale=t=linear:npl=100,format=gbrpf32le,zscale=p= 709,tonemap=hable:desat=2,zscale=t=709:m=709:r=tv, format=yuv420p
    Quote Quote  
  5. Originally Posted by ProWo View Post
    Originally Posted by slick zheng View Post
    i can't use this GUI, only can use ffmpeg CLI, do you know how to do same thing in CLI?

    Here you go:
    -vf zscale=t=linear:npl=100,format=gbrpf32le,zscale=p= 709,tonemap=hable:desat=2,zscale=t=709:m=709:r=tv, format=yuv420p
    this command has "No such filter: 'zscale'" error, my ffmpeg version is 6.0
    Quote Quote  
  6. Post your full commandline.
    Quote Quote  
  7. Originally Posted by ProWo View Post
    Post your full commandline.
    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
    but this has Impossible to convert between the formats supported by the filter 'Parsed_scale_npp_4' and the filter 'auto_scale_1' error, i guess this is because zscale doesn't support 10bit frame input? so i want to convert source input to yuv420p 8bit frame, but it doesn't work, could you give me some suggestions?
    Quote Quote  
  8. Originally Posted by slick zheng View Post
    Originally Posted by ProWo View Post
    Post your full commandline.
    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
    but this has Impossible to convert between the formats supported by the filter 'Parsed_scale_npp_4' and the filter 'auto_scale_1' error, i guess this is because zscale doesn't support 10bit frame input? so i want to convert source input to yuv420p 8bit frame, but it doesn't work, could you give me some suggestions?
    The zscale filter doesn't work with hardware acceleration.
    Quote Quote  
  9. Originally Posted by ProWo View Post
    Originally Posted by slick zheng View Post
    Originally Posted by ProWo View Post
    Post your full commandline.
    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
    but this has Impossible to convert between the formats supported by the filter 'Parsed_scale_npp_4' and the filter 'auto_scale_1' error, i guess this is because zscale doesn't support 10bit frame input? so i want to convert source input to yuv420p 8bit frame, but it doesn't work, could you give me some suggestions?
    The zscale filter doesn't work with hardware acceleration.
    bad message, so how can i do same color conversion thing with hardware acceleration?
    Quote Quote  
  10. Originally Posted by slick zheng View Post
    bad message, so how can i do same color conversion thing with hardware acceleration?
    No clue ...
    Quote Quote  
  11. Originally Posted by ProWo View Post
    Originally Posted by slick zheng View Post
    bad message, so how can i do same color conversion thing with hardware acceleration?
    No clue ...
    thanks bro
    Quote Quote  
  12. Originally Posted by ProWo View Post
    The zscale filter doesn't work with hardware acceleration.
    Seem zscale is not compiled in his ffmpeg build - it can be queried from ffmpeg by this command:
    ffmpeg -h filter=zscale > zscale.txt
    Last edited by pandy; 4th Aug 2023 at 15:34.
    Quote Quote  
  13. Originally Posted by pandy View Post
    Originally Posted by ProWo View Post
    The zscale filter doesn't work with hardware acceleration.
    Seem zscale is not compiled in his ffmpeg build - it can be queried from ffmpeg by this command:
    ffmpeg -h filter=zscale > zscale.txt
    i have installed zscale and the command without cuda is work, but it's too slow, so i want to use gpu to accelerate, but seems zscale doesn't support gpu accelerate
    Quote Quote  
  14. Originally Posted by slick zheng View Post
    Originally Posted by pandy View Post
    Originally Posted by ProWo View Post
    The zscale filter doesn't work with hardware acceleration.
    Seem zscale is not compiled in his ffmpeg build - it can be queried from ffmpeg by this command:
    ffmpeg -h filter=zscale > zscale.txt
    i have installed zscale and the command without cuda is work, but it's too slow, so i want to use gpu to accelerate, but seems zscale doesn't support gpu accelerate
    Referred to
    Originally Posted by slick zheng View Post
    this command has "No such filter: 'zscale'" error, my ffmpeg version is 6.0
    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
    Quote Quote  
  15. Originally Posted by pandy View Post
    Originally Posted by slick zheng View Post
    Originally Posted by pandy View Post
    Originally Posted by ProWo View Post
    The zscale filter doesn't work with hardware acceleration.
    Seem zscale is not compiled in his ffmpeg build - it can be queried from ffmpeg by this command:
    ffmpeg -h filter=zscale > zscale.txt
    i have installed zscale and the command without cuda is work, but it's too slow, so i want to use gpu to accelerate, but seems zscale doesn't support gpu accelerate
    Referred to
    Originally Posted by slick zheng View Post
    this command has "No such filter: 'zscale'" error, my ffmpeg version is 6.0
    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
    Quote Quote  
  16. Originally Posted by slick zheng View Post
    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 .
    Quote Quote  
  17. Originally Posted by pandy View Post
    Originally Posted by slick zheng View Post
    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 .
    thanks bro, i'll try your suggestion.
    Quote Quote  
  18. Member Lathe's Avatar
    Join Date
    Nov 2007
    Location
    Sunny Southern California
    Search Comp PM
    Originally Posted by ProWo View Post
    Search for HDR to SDR with tonemap.
    Can be done with clever Ffmpeg-GUI.

    Image
    [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.
    Aha! I see you also helped another fellow with this too I was doing more research into what choices and parameters there are within the color space setting.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!