Filtering artifact when using RGB color format

r0levrai

New Member
Hi there,

I'm using OBS to record (not stream) gameplay footage.
I want the video to be lossless, i.e. a frame of the video must have the same pixels colors as a screenshot, so that I can do funny but finicky things later (ocr, image recognition by matching against a known texture, etc). I very nearly achieved this by setting the x264 encoder to lossless (Settings>Output>Advanced>Recording> disable CBR, CRF = 0, ultrafast), the color encoding to I444 (Settings>Advanced>Video>Color Format>I444) and disabling down-scaling (Settings>Video>Scaled Resolution = Base resolution). But encoding in yuv4:4:4 (I444) slightly mess up the colors due to the conversion, so I want to use RGB.

When I use RGB, it introduces a strange "blur" of about one pixel radius, see the attached images. Is it a bug ? If not, is there a workaround ?

Thanks !
 

Attachments

  • mindustry_screenshoot.png
    mindustry_screenshoot.png
    578.7 KB · Views: 119
  • mindustry_i444.png
    mindustry_i444.png
    546.7 KB · Views: 88
  • mindustry_rgb.png
    mindustry_rgb.png
    945.6 KB · Views: 92
  • mindustry_rgb_error.png
    mindustry_rgb_error.png
    840.1 KB · Views: 73
  • mindustry_rgberror_times_20.png
    mindustry_rgberror_times_20.png
    842.4 KB · Views: 64
  • mindustry_i444_error.png
    mindustry_i444_error.png
    341.8 KB · Views: 52
  • mindustry_i444_error_times_100.png
    mindustry_i444_error_times_100.png
    342.4 KB · Views: 56

r0levrai

New Member
Investigating the *_error images (difference between a screenshot and an OBS recorded image), it seems like a quirk of the x264 encoder, which probably work in yuv space, since the blur is only horizontal, and the rgb image still have (on top of the blur) the slight flat color error. I guess I'm out of luck...

How should I go about this ? Play with Settings>Output>Recording>type>Custom Output (FFmpeg) where I can use a ffmpeg libx264rgb encoder that directly work in rgb ?
 

r0levrai

New Member
SOLVED !

using rgb color space with the libx264rgb encoder was indeed the solution. The only reason I spent so much time on this is because of the... debatable user interface OBS devs chose in some place ^^'

so :
- Settings > Advanced > Video > Color Format : RGB
- Settings > Advanced > Video > Color Format > Color Range/Color Space : whatever, it does not matter when using RGB (it could be grayed out)
- Settings > Output > Recording > type : Custom Output (FFmpeg)
- Container Format : 3g2 (or anything other than Default Format that does video and have libx264rgb in Video Encoder ; i don't now why but I cannot chose any encoder when Container Format is set to Default Format, thus this choice. I don't know why we can't choose flv or mkv here either)
- Video Encoder Settings (if any) : qp=0 (you'd expect a format matching the ffmpeg command line, but its neither "-qp 0", nor "qp 0", but "qp=0" u_u)
- I had to change the audio encoder to avoid a cryptic error because the default one was not on my machine

Bonus : I attached the extract_frame_from_last_video.py and compare_images.py scripts I used to debug this can of worms :)
 

Attachments

  • scripts.zip
    1.3 KB · Views: 38

r0levrai

New Member
Rather than just "qp=0", use "qp=0 preset=ultrafast" to prevent excessive CPU usage and stuttering/frame drops !
 
Top