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

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 version 20.1.3 (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 OBS files.

Next, grab OBS version 19.0.3 (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 OBS version 20.1.3’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 19.0.3 in place of the FFmpeg from your 20.1.3 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.

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. 19.0.3 doesn’t have these errors, but uses an ancient version of obs-ffmpeg, so do not put the 19.0.3 versions of the files on the latest OBS, but rather 20.1.3.


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 19.0.3 and use the obs-ffmpeg.so file from that build with the 20.1.3 version. (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.

4 Likes

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.

1 Like

Unfortunately, using different containers (because I initially thought the MOV container was causing the crashing issues) is NOT a remedy to the crashing problem. MXF crashes sometimes, and even MKV crashes sometimes… so it’s something to do with obs-ffmpeg crashing at the end of the recording specifically with DNxHD, and future versions have frame dropping issues that are still unsolved.

I brought this up to @Wendell and @EposVox at LTX 2019 and this would be so helpful for Davinci Resolve Lite users, but it’s down to if anyone is willing to put in the effort, which currently there is none on this.

For some reason this topic completely flew by me.
Sounds interesting.

Yes, and it was stable at one point, but then all future releases have frame dropping issues with DNxHD and the last releases that didn’t have the frame drop issue have the crashing upon stopping the recording issue.

MAJOR UPDATE:

Using the obs-ffmpeg DLL and PDB from 19.0.3, while having the rest of OBS be version 20.1.3 proved to be stable so far. 20.0 introduced the crashing regression.

If you use a Capture Card capture, you can get around capture performance issues with this in a dual system setup.

1 Like

Bump, with the rise of StreamFX ProRes recording…

Again, NEVER use FFmpeg ProRes. I’m hoping Xaymar can take the info from this thread to debug the current issue with DNxHR and DNxHD with OBS’ current FFmpeg version, and then make a DNxHD/DNxHR preset in StreamFX which would work in Premiere CC without anything extra.

Great article, it helped me a lot, thank you!

1 Like

Update: Seems OBS 26.0.2 restores performance for recording, but unfortunately has a critical flaw:

pix_fmt flags are no longer passed down in the chain or adapted for compatibility. It defaults to the pix_fmt set by Advanced -> Color Format and tries to force it. It ignores pix_fmt flags anywhere in the video or muxer settings.

This ruins 4:2:2 recording of DNxHD as NV12 is basically 4:2:0 for the entire image pipeline and is the only working mode. So there will be no quality improvement chroma-wise vs NVENC if you try this on a recent version of OBS.

Edit: seems profile=dnxhr_444 does work if the color format in Advanced is RGB, but it requires a 3950X to encode just 1080p60. However, if it’s RGB, the output video is not compatible with Premiere and encoding hitches. Using i444 is compatible with Premiere and doesn’t hitch when encoding. It requires the Color Space to be sRGB and the Color Range to be “Full,” and the process priority is “High.” This is a good CPU realtime encoding test.

However, for more CPU friendly encoding, OBS has to have a pix_fmt override for the output, while the Advanced -> Color Format setting is only for the render canvas, not the FFmpeg output.

Okay, making another post for 4:4:4 recording using DNxHR. This is resolution independent (within the confines of 720p, 1080p and 4K. 1440p will still not work)


Video tab

FPS: 60

Output tab

Output mode: Advanced

Recording tab

Type: Custom Output (FFmpeg)

Check “Generate File Name without Space”

Container format: mov

Keyframe Interval (Frames): 1

Video Encoder: dnxhd

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

Video Encoder Settings: profile=dnxhr_444

Audio Bitrate: 2304 Kbps

(Choose whichever audio track fits your recording situation)

Audio Encoder: pcm_s24be (more compatible with Apple devices)

Advanced tab

Process Priority: High

Color Format: I444

Color Space: sRGB

Color Range: Full


Tested with OBS 26.0.2 on 10 1903 and in Premiere Pro 14.3 (CC 2020 with NVENC) and it loads the file perfectly. Be sure you have a 12 core CPU and up to encode 1080p60, and a 3990X (guessing, but might need more) to encode 4K60.

Aside from practical uses, this is a great CPU realtime encoding benchmark.