VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. I know that to get 8 bit rgb I need to use a 10 bit or more yuv. I couldn't find yuv444p10le, so I chose yuv444p16le (but ffprobe shows yuv444p10le anyway).
    Code:
    ffmpeg -y -vsync 0 -i %01d.png -pix_fmt yuv444p16le -c:v hevc_nvenc -tune lossless out.mov
    ffmpeg -i out.mov -pix_fmt rgb24 img/out-%03d.png
    ffmpeg -i img/out-%03d.png -i %01d.png -filter_complex ssim -f null -
    SSIM R:0.999988 (49.290492) G:1.000000 (inf) B:0.999971 (45.373878) All:0.999986 (48.665779)
    The result is not lossless. What am I doing wrong?
    Image Attached Thumbnails Click image for larger version

Name:	1.png
Views:	79
Size:	102.9 KB
ID:	62470  

    Click image for larger version

Name:	2.png
Views:	25
Size:	10.4 KB
ID:	62471  

    Quote Quote  
  2. Originally Posted by qo4on View Post
    I know that to get 8 bit rgb I need to use a 10 bit or more yuv. I couldn't find yuv444p10le, so I chose yuv444p16le (but ffprobe shows yuv444p10le anyway).
    Code:
    ffmpeg -y -vsync 0 -i %01d.png -pix_fmt yuv444p16le -c:v hevc_nvenc -tune lossless out.mov
    ffmpeg -i out.mov -pix_fmt rgb24 img/out-%03d.png
    ffmpeg -i img/out-%03d.png -i %01d.png -filter_complex ssim -f null -
    SSIM R:0.999988 (49.290492) G:1.000000 (inf) B:0.999971 (45.373878) All:0.999986 (48.665779)
    The result is not lossless. What am I doing wrong?
    Verify supported pixel formats and encoder options with help of:
    Code:
    ffmpeg -h encoder=hevc_nvenc >hevc_nvenc.txt
    Verify if HEVC lossless is supported by your NVEnc (IIRC only Pascal and newer silicone is capable to do so).
    Quote Quote  
  3. Code:
    Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda d3d11
    
      -tune              <int>        E..V....... Set the encoding tuning info (from 1 to 4) (default hq)
         lossless        4            E..V....... Lossless
    I use GTX 1060, it is Pascal. So, everything seems to be ok.
    Quote Quote  
  4. run ffmpeg with report active - perhaps some color space conversion is applied automatically - ffmpeg can do such things without notification...

    you can try to use zscale or colorspace video filter to manually manage all this - also for lossless RGB conversion i would use personally YCgCo color space instead YUV (qood question if nvenc can be faked to use YCgCo as YUV)
    Quote Quote  
  5. I don't know what to do about it:
    Code:
    cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    [graph 0 input from stream 0:0 @ 00000272c1abc140] Setting 'video_size' to value '1920x1080'
    [graph 0 input from stream 0:0 @ 00000272c1abc140] Setting 'pix_fmt' to value '26'
    [graph 0 input from stream 0:0 @ 00000272c1abc140] Setting 'time_base' to value '1/25'
    [graph 0 input from stream 0:0 @ 00000272c1abc140] Setting 'pixel_aspect' to value '3780/3780'
    [graph 0 input from stream 0:0 @ 00000272c1abc140] Setting 'frame_rate' to value '25/1'
    [graph 0 input from stream 0:0 @ 00000272c1abc140] w:1920 h:1080 pixfmt:rgba tb:1/25 fr:25/1 sar:3780/3780
    [format @ 00000272c1abc800] Setting 'pix_fmts' to value 'yuv444p16le'
    [auto_scaler_0 @ 00000272c1abc900] Setting 'flags' to value 'bicubic'
    [auto_scaler_0 @ 00000272c1abc900] w:iw h:ih flags:'bicubic' interl:0
    [format @ 00000272c1abc800] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
    [AVFilterGraph @ 00000272c1ab6900] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed
    [auto_scaler_0 @ 00000272c1abc900] w:1920 h:1080 fmt:rgba sar:3780/3780 -> w:1920 h:1080 fmt:yuv444p16le sar:1/1 flags:0x4
    Image Attached Files
    Quote Quote  
  6. Try to verify steps so for example at first skip nvenc, secondly use software x265 - perhaps nvenc is not lossless...
    Quote Quote  
  7. x265 shows the same result.
    Quote Quote  
  8. Originally Posted by qo4on View Post
    x265 shows the same result.
    libx265 is ok on 1.png

    Code:
    ffmpeg -i 1.png -vf scale=out_color_matrix=bt709,format=yuv444p10le -c:v libx265 -x265-params lossless=1 libx265.mp4
    ffmpeg -i libx265.mp4 -vf scale=in_color_matrix=bt709,format=rgb24 libx265_to_png.png
    ffmpeg -i libx265_to_png.png -i 1.png -filter_complex ssim -f null -
    Code:
    [Parsed_ssim_0 @ 000000b166aa1d40] SSIM R:1.000000 (inf) G:1.000000 (inf) B:1.000000 (inf) All:1.000000 (inf)
    Quote Quote  
  9. Will you be able to compare source and decoded result (for example by subtracting) it could be interesting to check whether issue is in levels or in edges (simplification for this discussion).
    Alternatively you can try to sent RGB without conversion to YUV - perhaps this can be issue.

    Of course as always with NVEnc you should use latest NVidia API version.
    Quote Quote  
  10. Originally Posted by poisondeathray View Post
    Code:
    ffmpeg -i 1.png -vf scale=out_color_matrix=bt709,format=yuv444p10le -c:v libx265 -x265-params lossless=1 libx265.mp4
    ffmpeg -i libx265.mp4 -vf scale=in_color_matrix=bt709,format=rgb24 libx265_to_png.png
    Thank you! You are right. Your settings are truly lossless, all pixels are exactly the same with a difference of 0. Nvenc is also lossless.

    Do you know why ffmpeg uses yuv444p16le even though I specified yuv444p10le? Although checking after conversion with ffprobe shows that the file is yuv444p10le:
    Code:
    ffmpeg -y -r 60 -i %01d.png -vf scale=out_color_matrix=bt709,format=yuv444p10le -c:v hevc_nvenc -tune lossless out.mov
    
    Stream mapping:
      Stream #0:0 -> #0:0 (png (native) -> hevc (hevc_nvenc))
    Press [q] to stop, [?] for help
    cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    [Parsed_scale_0 @ 000002470b93d840] Setting 'out_color_matrix' to value 'bt709'
    [Parsed_scale_0 @ 000002470b93d840] Setting 'flags' to value 'bicubic'
    [Parsed_scale_0 @ 000002470b93d840] w:iw h:ih flags:'bicubic' interl:0
    [Parsed_format_1 @ 000002470b93c7c0] Setting 'pix_fmts' to value 'yuv444p10le'
    [graph 0 input from stream 0:0 @ 000002470b9bac40] Setting 'video_size' to value '1920x1080'
    [graph 0 input from stream 0:0 @ 000002470b9bac40] Setting 'pix_fmt' to value '26'
    [graph 0 input from stream 0:0 @ 000002470b9bac40] Setting 'time_base' to value '1/60'
    [graph 0 input from stream 0:0 @ 000002470b9bac40] Setting 'pixel_aspect' to value '3780/3780'
    [graph 0 input from stream 0:0 @ 000002470b9bac40] Setting 'frame_rate' to value '60/1'
    [graph 0 input from stream 0:0 @ 000002470b9bac40] w:1920 h:1080 pixfmt:rgba tb:1/60 fr:60/1 sar:3780/3780
    [format @ 000002470b9bb080] Setting 'pix_fmts' to value 'yuv420p|nv12|p010le|yuv444p|p016le|yuv444p16le|bgr0|rgb0|cuda|d3d11'
    [auto_scaler_0 @ 000002470b9bb600] Setting 'flags' to value 'bicubic'
    [auto_scaler_0 @ 000002470b9bb600] w:iw h:ih flags:'bicubic' interl:0
    [format @ 000002470b9bb080] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_format_1' and the filter 'format'
    [AVFilterGraph @ 000002470b937280] query_formats: 5 queried, 3 merged, 1 already done, 0 delayed
    [auto_scaler_0 @ 000002470b9bb600] picking yuv444p16le out of 8 ref:yuv444p10le alpha:0
    [Parsed_scale_0 @ 000002470b93d840] w:1920 h:1080 fmt:rgba sar:3780/3780 -> w:1920 h:1080 fmt:yuv444p10le sar:1/1 flags:0x4
    [auto_scaler_0 @ 000002470b9bb600] w:1920 h:1080 fmt:yuv444p10le sar:1/1 -> w:1920 h:1080 fmt:yuv444p16le sar:1/1 flags:0x4
    
      Stream #0:0: Video: hevc (Rext) (hev1 / 0x31766568), yuv444p16le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 60 fps, 15360 tbn
    
    ffprobe
      Stream #0:0: Video: hevc (Rext) (hev1 / 0x31766568), yuv444p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 67964 kb/s, 60 fps, 60 tbr, 15360 tbn, 60 tbc (default)
    Quote Quote  
  11. Another question. libx265 outputs 8-bit lossless rgb hevc video:
    Code:
    ffmpeg -y -r 60 -i %01d.png -c:v libx265 -x265-params lossless=1 out.mov
    Stream #0:0: Video: hevc (Rext) (hev1 / 0x31766568), gbrp(pc, gbr/unknown/unknown, progressive), 1920x1080, 9468 kb/s, 60 fps, 60 tbr, 15360 tbn, 60 tbc (default)
    Is there hevc_nvenc alternative for this command? So, it would be possible to get 8-bit lossless video without using 10-bit files.

    hevc_nvenc supports: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda d3d11
    I tried:
    Code:
    ffmpeg -y -r 60 -i %01d.png -vf format=rgb0 -c:v hevc_nvenc -tune lossless out.mov
    But it outputs yuvj420p, which is not lossless.
    Last edited by qo4on; 24th Dec 2021 at 19:01.
    Quote Quote  
  12. AFAIK, RGB output is not supported by NVEnc
    Quote Quote  



Similar Threads

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