VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 32
Thread
  1. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    Recently i started to pay attention around quicksync/NVENC colors since i use they sometimes to record gameplay and yet to encoding some footage wtih FFMpeg.

    What i see is than apparently they have limited colormatrix around softwares. Shadowplay which is NVIDIA own recorder tag video file with BT.601 even for HD recording. OBS for example give options to use BT709 with NVENC if desired or 601 but it dont work. In OBS even using BT709 or BT601 for NVENC it output same colors but they are tagged differently. OBS NVENC bt709/BT601 tagged files has same colors than Shadowplay bt601 tagged file.

    Another issue recently i tried to convert some bt601 files with FFMpeg Quicksync but it always convert to bt709 and looks like bt601 is not supported with Quicksync there. With NVENC i was successful converting bt601 footage with FFMpeg.

    I use MPC-HC to watch footage so i dont know if its convertin wrong colors. My Hardware is First gen Kepler and Haswell quicksync.

    The biggest issue is with MSI Afterburner which output wrong colors for both QS/NVENC, it dont looks same to any other recorder bt601/bt709.
    Quote Quote  
  2. Originally Posted by chummy02 View Post
    Another issue recently i tried to convert some bt601 files with FFMpeg Quicksync but it always convert to bt709 and looks like bt601 is not supported with Quicksync there.
    Can you post the ffmpeg log? I would think ffmpeg's filtering would do conversions to YUV (if required) and thus be in your full control. See "scale" filter options.

    Originally Posted by chummy02 View Post
    I use MPC-HC to watch footage so i dont know if its convertin wrong colors.
    I recommend using madvr renderer. Then press ctrl+j to see its OSD. It will tell you about what color it thinks the source has.
    Quote Quote  
  3. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    OBS tagged x264 file as bt709 and it has same colors as Shadowplay bt601 tagged file but it has different colors from OBS x264 bt601. All of them are 1080p so madvr guess it's bt709 when there is not tag even if its not bt709.

    See the samples.
    Image Attached Files
    Quote Quote  
  4. I don't understand. What exactly should I be looking at? They look identical to me.
    Image Attached Thumbnails Click image for larger version

Name:	shadowplay.png
Views:	363
Size:	1.91 MB
ID:	42107  

    Click image for larger version

Name:	obs.png
Views:	227
Size:	1.91 MB
ID:	42108  

    Quote Quote  
  5. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    Yes they look same but each recording software tagged the color differently. If you look madvr guess color it say bt601 for the shadowplay one and bt709 for the other. So what color is the correct one. Who is tagging it wrong, i guess its bt709 right? So Shadowplay is tagging it wrong..


    Edit: People complain about Shadowplay 601 for NVIDIA for ages in their forums but apparently the colors are bt709, only tagged wrongly.
    Quote Quote  
  6. Originally Posted by chummy02 View Post
    Yes they look same but each recording software tagged the color differently. If you look madvr guess color it say bt601 for the shadowplay one and bt709 for the other. So what color is the correct one. Who is tagging it wrong, i guess its bt709 right? So Shadowplay is tagging it wrong..


    Edit: People complain about Shadowplay 601 for NVIDIA for ages in their forums but apparently the colors are bt709, only tagged wrongly.

    Both are tagged correctly.

    If you use 709 to view your obs sample, it looks the same as 601 to view the Shadowplay example

    The problem occurs when someone uses software that ignores flags; for example if a player assumed since the shadowplay was "HD" and used 709, the colors would appear "wrong"
    Quote Quote  
  7. Both videos are flagged correctly. The rec.601 video has rec.601 colors, the rec.709 video has rec.709 colors. If your player plays them properly the will both look the same on-screen. Some players ignore the colormatrix flag and always use one matrix or the other.
    Quote Quote  
  8. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    Originally Posted by poisondeathray View Post
    Both are tagged correctly.

    If you use 709 to view your obs sample, it looks the same as 601 to view the Shadowplay example

    The problem occurs when someone uses software that ignores flags; for example if a player assumed since the shadowplay was "HD" and used 709, the colors would appear "wrong"
    So is same as color range, it only show different colors when guessed wrongly. I thought bt601 and bt709 has different colors, there is some old color graph around web which shows bt601 with different colors than bt709, i guess this is wrong then.




    Edit: How i do to determine the colormatrix from not tagged file? Is there a way?

    Then in OBS NVENC is only one working properly. Quicksync dont tag file and recording with bt709 and bt601 give different color results. Same happens to x264.
    Last edited by chummy02; 26th Jun 2017 at 13:31.
    Quote Quote  
  9. Originally Posted by chummy02 View Post
    Edit: How i do to determine the colormatrix from not tagged file? Is there a way?
    You generally assume rec.709 for HD, rec.601 for SD. But that's not always the case. If you don't know what the colors are supposed to be you just have to guess.
    Quote Quote  
  10. Your game is running in RGB. But for video codecs it is common to store as YCbCr instead of RGB. When RGB is converted to YCbCr a colormatrix is used (simplified).
    Software A converts from RGB to YCbCr using BT.601 and flags the file as BT.601.
    Software B converts from RGB to YCbCr using BT.709 and flags the file as BT.709.
    Both are correct. Neither is wrong. What you are seeing on your display is the conversion back from YCbCr to RGB. Not the stored values.
    Quote Quote  
  11. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    Then my problem with FFMpeg and Quicksync is than using Quicksync it dont tag files, is there another way to do that? Add this "-color_primaries bt709 -color_trc bt709 -colorspace bt709" works for NVENC but not for Quicksync in FFMpeg.
    Quote Quote  
  12. Again: post log. Control color conversion via e.g. "scale".
    Quote Quote  
  13. qsvenc allows you to specify the colormatrix. From the docs:

    Code:
       --colormatrix <string>       undef, auto, bt709, smpte170m, bt470bg
                                    smpte240m, YCgCo, fcc, GBR
                                     default: undef
       --colorprim <string>         undef, auto, bt709, smpte170m, bt470m
                                    bt470bg, smpte240m, film
                                     default: undef
       --transfer <string>          undef, auto, bt709, smpte170m, bt470m
                                    bt470bg, smpte240m, linear, log100, log316
                                     default: undef
    I verified it works and MediaInfo shows the flag.
    Quote Quote  
  14. yes, rigaya's qsvencc can specify the flags, but ffmpeg's qsvenc cannot (it will be left unflagged, which might be ok in some situations)

    But rigaya's qsvencc cannot do a colormatrix conversion , but ffmpeg can (ideally you'd probably want to convert 601=>709 for HD if you were re-encoding it)

    You can pipe ffmpeg with -vf scale or -vf colormatrix to convert 601=>709 , into qsvencc but I don't think take multiple stream inputs (no audio if piping) . I guess you could make script with temp files, and delete them with ffmpeg/mp4box/mkvmerge to mux the audio

    Alternatively, keep it 601 and flag it 601 with qsvencc only (--avqsv can keep the audio as stream copy) , but I wouldn't do that. HD should be 709

    Or use a 2nd tool to "patch" the flags after ffmpeg's conversion, like roozhous ffmpeg build
    Last edited by poisondeathray; 26th Jun 2017 at 14:31.
    Quote Quote  
  15. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    Scale dont tag files, only way i find to tag files is using the command i show and that is only for x264 or NVENC in FFMpeg.

    QSVenc and NVEnc are the most advanced in implementation, i know, but since i used for batching AVS scripts with audio support FFMpeg was my preference.

    Thanks for all support and explanations.
    Quote Quote  
  16. Originally Posted by chummy02 View Post
    Scale dont tag files
    Even if not you could control the conversion to BT.709 for HD. Since basically every player assume HD to be BT.709 then you won't have any problems even without explicit flagging.

    (If the lib exposes colormatrix setting maybe ask ffmpeg team for feature?)
    Quote Quote  
  17. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    Originally Posted by sneaker View Post
    Even if not you could control the conversion to BT.709 for HD. Since basically every player assume HD to be BT.709 then you won't have any problems even without explicit flagging.
    Ok, i understand now. Conversion to correct color for HD(bt709) is ok to me.
    Last edited by chummy02; 26th Jun 2017 at 16:51.
    Quote Quote  
  18. Originally Posted by chummy02 View Post
    How i do to determine the colormatrix from not tagged file? Is there a way?
    I made a colorbar generator for exactly this purpose. It's called FRAFS Test Pattern.

    You record a few seconds of this output:
    Image
    [Attachment 42112 - Click to enlarge]

    (text added to point out all the little extra features)

    Observe the playback. If your playback decoding does not match OBS's encoding, the colors will be shifted (as in your image above) or the levels will be wrong.

    The correct levels for each bar are marked in the output, so you can screen-grab your playback, open the image in a paint editor, and check to see if the values are correct. You can also skip the paint editor and probe screen colors directly with a tool such as the free ColorPic.
    Quote Quote  
  19. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    I just done some encoding tests with "scale range" for Afterburner sources. It's encoded with bt601 for HD but is not tagged for both colormatrix or color range. For colormatrix its already fine but for color range i tried 4 conversions to check.

    in=PC: out=PC
    in=PC: out=TV
    in=TV: out=TV
    in=TV: out=PC

    PCtoTV and TVtoPC conversions give same color output but for PCtoPC and TVtoTV the color get brighter and darker respectively.

    I dont get the point why colors differ in PCtoPC and TVtoTV. TVtoTV is the one which looks same to OBS, NVIDIA colors.

    When i dont know the color range from a input, should i guess input range to ffmpeg or can i only give output range and it will convert properly?

    Edit: Just to be clear i doing a colormatrix conversion from 601 to 709 and want to do the correct color range conversion. If i keep bt601 range value results differs from if i convert colormatrix to 709.
    Last edited by chummy02; 27th Jun 2017 at 11:10.
    Quote Quote  
  20. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    What i mean is than converting HD 601 with ffmpeg scale to bt709 is causing a small change to color(im not sure if luminance or chroma). Is that slight change considered normal or is something going wrong when colors dont match 100%?
    Image Attached Files
    Quote Quote  
  21. Looks wrong. Post ffmpeg command and log.
    Quote Quote  
  22. yes -vf scale=in_color_matrix=bt601ut_color_matrix=bt709 looks wrong on your sample for some reason

    -vf colormatrix=bt601:bt709 looks correct

    Or you can do in the avs script since you're doing this with batch avs
    Quote Quote  
  23. colormatrix works but can produce banding.

    zscale filter seems to be good (with activated dither)
    Quote Quote  
  24. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    Originally Posted by sneaker View Post
    colormatrix works but can produce banding.

    zscale filter seems to be good (with activated dither)
    How i do colormatrix conversion with zscale, can you provide command?
    Quote Quote  
  25. You do realize ffmpeg has a documentation, right?
    https://ffmpeg.org/ffmpeg-filters.html#zscale

    -vf zscale=matrixin=470bg:matrix=709:dither=ordered
    Quote Quote  
  26. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    Yes i know. I tried first some times, but i get "strange" results so i wanted to be sure. Zscale caused a negligible change in colors green, blue and magenta which i dont noticed with colormatrix conversion. So i wanted to be sure i done correctly.

    Thanks.
    Quote Quote  
  27. To me colormatrix looks worse. But it's not a lossless procedure and it's difficult content.
    Image Attached Thumbnails Click image for larger version

Name:	source.png
Views:	171
Size:	1.95 MB
ID:	42158  

    Click image for larger version

Name:	colormatrix.png
Views:	186
Size:	1.96 MB
ID:	42159  

    Click image for larger version

Name:	zscale.png
Views:	190
Size:	2.19 MB
ID:	42160  

    Quote Quote  
  28. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    So using MSI Afterburner for recording i noticed than with NVENC and Quicksync it was producing some chroma loss for some specifc areas like tiny lines, i dont know the correct term to define this issue. I then reencoded some UTvideo and MAgicYUV sources with FFMpeg NVENC and noticed it produced same chroma losses than occured in Afterburner.
    I get a OBS NVENC source which dont have such issue. I encoded the OBS NVENC source with FFMpeg nvenc and Rigaya nvenCc. So FFMpeg produces some chroma shift while Rigaya keeps it more accurately.
    Image Attached Files
    Quote Quote  
  29. Almost like interlaced chroma, or some chroma aliasing. You probably used the wrong settings, or weren't using -pix_fmt nv12 for ffmpeg nvenc . If you look at the console log, rigaya's nvencc automatically converts to nv12

    See this post and screenshots
    https://forum.videohelp.com/threads/383320-So-what-s-the-status-on-hardware-accelerate...ng#post2484298
    Last edited by poisondeathray; 5th Jul 2017 at 21:19.
    Quote Quote  
  30. Member
    Join Date
    Sep 2016
    Location
    Brazil
    Search PM
    You're correct, that was lack of nv12 conversion. Wasn't FFMpeg doing NV12 conversion automatically for nvenc before? I always used it without specify nv12 and i dont remember it caused issue in past.

    For Quicksync FFMpeg does nv12 conversion automatically.
    Quote Quote  



Similar Threads

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