Return to Level1Techs.com

Jack's Software: DNxHD recording using OBS (article only)

obs
#1

Unfortunately, this one doesn’t deserve to be made into a video because the OBS project has made it hard for people to run this stable.

By agreeing to record stuff in DNxHD, you accept the responsibility and risk that there is a completely RNG chance OBS will crash upon ending the recording, or OBS will fail to start the recording because of a receive_audio: Error writing packet: Invalid argument error. This will mean failed recordings if unmonitored.

DO NOT USE THIS IN A MISSION CRITICAL ENVIRONMENT. YOU HAVE BEEN WARNED.


So, if you own an Atomos recorder, you know it can record DNxHD and DNxHR (after activation), but did you know OBS can do this too?

OBS under the “Custom (FFmpeg)” output can actually record DNxHD and DNxHR!

It will require some preparation, but I’m assuming you will be targeting 1080p60 and 4K60. 1440p is not an official broadcast resolution so DNxHD and DNxHR will not work with 1440p. In case where you need 1440p, stick to NVENC or x264.

The following instructions are for Windows


Getting OBS:

You’ll want to grab the ZIP of OBS’ latest version (the Small version) and unzip that to an “OBS” folder somewhere.

Make a new blank text file called portable_mode.txt in the same folder as the rest of the unzipped latest OBS version files.

Next, grab OBS version 20.0.1 (Small version ZIP) and navigate to /obs-plugins/64bit within the ZIP file.

Extract obs-ffmpeg.dll and obs-ffmpeg.pdb and place them in your extracted latest OBS version’s /obs-plugins/64bit. Overwrite the existing files.


Now you need to create the custom FFmpeg outputs. Settings not mentioned are assumed to be left at defaults.

Common

Video tab

FPS: 60

Output tab

Output mode: Advanced

Recording tab

Check “Generate File Name without Space”

Container format: mov

Keyframe Interval (Frames): 1

Video Encoder: dnxhd

Audio Bitrate: 2304 Kbps

(Choose whichever audio track fits your recording situation)

Audio Encoder: pcm_s24le

Advanced tab

Color Format: I444

Color Space: 709


For 1080p60

Video tab

Base Resolution and Output Resolution: 1920x1080

Output tab

Recording tab

Video Bitrate: 290000 Kbps


For 4K60

Video tab

Base Resolution and Output Resolution: 3840x2160

Output tab

Recording tab

Video Bitrate: 0 Kbps (defaults to automatic bitrate selection)

Video Encoder Settings: profile=dnxhr_sq


With the older version of FFmpeg from 20.0.1 in place of the FFmpeg from your latest OBS version, DNxHD and DNxHR will encode properly. If you use the FFmpeg version that came with your latest version of OBS, the encoder will drop frames even though it’s using the correct CPU usage.

However, the newest FFmpeg version is more stable than the one from 20.0.1. With the 20.0.1 FFmpeg, you will encounter completely random crashes upon stopping recordings, and sometimes OBS will refuse to record because of a receive_audio error.

This is not ideal at all.


However in an ideal world, what are the system requirements CPU-wise?

1080p60, Second System

Ryzen 5 3600X

1080p60, Same System

Any 2nd Gen Ryzen 7 CPU and up with 8 cores.

4K60, Second System

Ryzen 9 3900X (12 cores)

4K60, Same System

Ryzen 9 3950X (16 cores)

Keep in mind that if you’re running Same System setups, it’s worth it to get Process Lasso (when using Windows) to make sure the capture and the game are smooth.

GPU requirements vary depending on if it’s same system or dual system. Dual system for both 1080p60 and 4K60 needs no less than a GTX 1660 Ti on the Recording computer. Same system is identical for 1080p60, but I recommend a RTX 2080 (or 2080 Super) for 4K60.


Linux

All the same parameters apply, but since FFmpeg is a separate binary on Linux, you can experiment to find which version won’t drop frames and also won’t crash on exit. More recent versions of FFmpeg (or obs-ffmpeg.so) will have the same issue as Windows, so it may be worth it to experiment with an older version of FFmpeg until you find one that doesn’t suffer from these issues.

If this has no effect, it may be worth it to build a portable Linux version of 20.0.1 and use the obs-ffmpeg.so file from that build. (I think this is more likely the actual issue)

This is for the niche audience pursuing this though, as the majority of OBS users are on Windows. Please post if you find a stable FFmpeg Linux version and/or obs-ffmpeg.so version that can record DNxHD (Critically, IN REALTIME) without issues.


I expect this to be a fun weekend project for some of you, but PLEASE do not use this in a mission critical work environment just yet until the OBS devs work out why DNxHD drops frames like crazy in the recent versions of OBS on Windows. If they can’t figure it out… CONTRIBUTE A FIX!

The results you get though are rather stunning. Far better than 4:2:0 chroma subsampled NVENC or x264. Going with the same chroma resolution with x264 would murder the CPU, but DNxHD being a wavelet codec means you can get 4:2:2 quality without the computing expense of something like NVENC Lossless (which doesn’t work in as many NLEs as you think) or x264 Lossless.

The recordings should work OOTB with Premiere CC 2017 and up, and Davinci Resolve 16 and up on Linux. Decode is also far easier on the CPU than x264 or NVENC.

In fact, to the average gamer, the difference is visually lossless vs FRAPS, and is MUCH more bandwidth friendly vs FRAPS.

The only thing this cannot do is record 10bit video, because the OBS canvas pipeline is completely 8bit video, hence why I did not choose the highest recording profile for DNxHD and DNxHR.

So go! Make a capture and see for yourself how DNxHD can improve your recording quality vastly!


P.S.: Why not ProRes?

NEVER… EVER… use FFmpeg ProRes. It’s a reverse engineered version of a proprietary codec that is nowhere near the quality of actual ProRes. DNxHD FFmpeg was built from non-private specifications for it as specified by SMPTE VC-3, meaning it has better quality.

2 Likes

#2

Just realized this could cut out a transcode step for Davinci Resolve 16 users on Linux, because Resolve on Linux has ZERO H.264 support and likely won’t until the MPEG-LA patents on H.264 expire, which is in a decade or more.

This should bring the OBS project to give more attention to this since this would help content creation on Linux if OBS can flawlessly capture DNxHR to import directly into a Resolve timeline.

0 Likes