Resource icon

(Almost) Lossless local recoding using OBS-Studio

Thanks to Sapiens' help, I've put up the following method for making (almost) lossless local recordings using x264 lossless encoding. It is useful for making high quality screen recordings that can be edited/transcoded later offline using a slower codec.

It is made possible by the OBS-mp release since 0.10.0, where YUV 4:4:4 and RGB color space support are added. It is almost lossless because the conversion from RGB to YUV 4:4:4 is not truly lossless (you can't get back bitwise identical images), but it is way much better than using 4:2:0, and considered by many people to be an acceptable form of 'lossless'.

SETTINGS
Output -> Output Mode: Advanced (Simple mode will always generate I420 output files).
Go to the Recording tab, set:
  • CPU Usage Preset: ultrafast
  • x264 Options: qp=0
The other should be default to:
  • Use CBR: yes
  • Bitrate: doesn't matter
Video:
  • Scaled Resolution should equal to Base Resolution
  • Common FPS Values: choose one you prefer. I'm using 48 fps.
Advanced:
  • Video Color Format: I444
  • YUV Color Space: 709
  • YUV Color Range: Partial
You can tweak other options according to your computer and program.

SOME MEASUREMENTS
My CPU is Intel i7-3770 @ 3.40GHz. It handles x264 lossless @ 48fps effortlessly. And the recording has negligible impact on my gaming, which is much better than all other recorder/codecs I have experimented with (I've tried a lot, including Lagarith, MJPG, huffyuv, etc.).

Data volumes (input is 1900x1200, fps varies):
  • x264 lossless ultrafast (48 fps): 62-70 MB/s
  • x264 lossless veryfast (48 fps): ~52 MB/s
  • Lagarith lossless (20 fps): ~66 MB/s
  • MJPG lossy, 85% quality (30 fps): ~14 MB/s
I don't have space on my internal storage so I have to record to an external USB 3.0 HDD, which can sustain about 75~80 MB/s. x264 ultrafast is within this limit. If your storage is even slower, you can try changing ultrafast to veryfast to reduce file size by sacrificing more CPU cycles.

It may be worth nothing that I don't archive these recorded files. I record a lot, and pick the best clips and compress them again using the much slower x265, which can generally achieve 6:1 to 10:1 compression ratio with almost no perceptible quality loss.

FUTURE WORK
It is possible to use FFmpeg to do true RGB compression, albeit less efficiently.
Author
ElliotLi
First release
Last update
Rating
5.00 star(s) 1 ratings

Latest reviews

Brilliant work. Videos look great and have the right colors. Good for editing.
Top