# h.265 Hardware Encoding for Recording w/Multiple Audio Tracks



## JasonVP (Nov 21, 2018)

Let me preface this by saying I may be mistaken about a couple of the things here.  With that:

I've started playing games @4K with HDR enabled.  When recording with OBS and NVENC, the results are overly-saturated; my understanding is that h.264 just doesn't have the bit bandwidth to handle HDR?  But h.265 does.

I know h.265 hardware/NVENC is available via custom FFMPEG lines, but when you do that, you can't _also _record multiple audio tracks.  And that's something I make very heavy use of when recording.  Are there plans to get h.265/HEVC hardware encoding as an option for Recording (only!) with multiple audio tracks?

Thanks.


----------



## Osiris (Nov 21, 2018)

OBS would need to have 10bit support for it to be able to record HDR. Both the H264 and H265 spec support 10bit.


----------



## JasonVP (Nov 21, 2018)

Osiris said:


> OBS would need to have 10bit support for it to be able to record HDR. Both the H264 and H265 spec support 10bit.



Yeah; again, pardon my admitted ignorance on the topic.  The more I think about this, the less it sounds like a useful idea to be able to record HDR unless OBS somehow converted it down to SDR in the process.  And that would be somewhat taxing.

However, I still do think having access to hardware h.265 with multiple audio tracks would be damned useful just for recording.  The file sizes are quite smaller! :-)  Obviously this comes with a catch: the files are harder to work with because of the encoding and compression.  I don't see that as a problem, personally.


----------



## pkv (Nov 21, 2018)

multiple audio tracks for ffmpeg output will come in next release; I coded support for that feature and it was merged a few weeks ago.


----------



## JasonVP (Nov 22, 2018)

pkv said:


> multiple audio tracks for ffmpeg output will come in next release; I coded support for that feature and it was merged a few weeks ago.



Cool!


----------



## DeMoN (Dec 10, 2018)

pkv said:


> multiple audio tracks for ffmpeg output will come in next release; I coded support for that feature and it was merged a few weeks ago.


Better late than never.
I really wonder why it took OBS so long to support that?
ffmpeg can do multiple tracks since decades. It even could write the audios outside if you wish to do so (e.g into two .wav files if 2 audiotracks)

There are some other things I really have to wonder about in OBS, like using deprecated ffmpeg stuff like global_quality which is not just deprecated, its even logged in the OBS Log xD
Or that you can only define keyframes in seconds instead of frames while the commandline uses frames which is by far more accurate than seconds. Because the lowest value you can do is 1 second or automatic. 1 frame = impossible due to this. I dont need this, but I know people who would like to have it, especially because OBS' files had always bad seekability, but maybe it is solved with fixing the 1000fps header bug, I didnt test it. But I could imagine this fixed it.

Or why we cant despite MKV just record audio into AAC and not PCM or FLAC?

Why still the original configs of directshow devices isnt used. Their own implementation still is unable to initialize datapath capture cards.

OBS is really nice, but still some stuff is weird implemented and/or missing.


----------



## Osiris (Dec 11, 2018)

The simple answer to why OBS took so long to support it is time and priority, also OBS is not just a frontend for the ffmpeg CLI.
There is only 1 actual main dev on OBS, the rest contribute features they need or find interesting/challenging to create.


----------



## pkv (Dec 11, 2018)

in the case at hand i wrote the feature because it had been requested and thought it fun to code, not because i need it. For features you want, feel free to make suggestions on : ideas.obsproject.com or upvote some you'd like to make it sooner in the codebase


----------



## DeMoN (Dec 11, 2018)

Many people will thank you for it ;)
especially because OBS itself doesnt allow PCM Audio capture at normal mode. Just AAC. And I dont want lossy audio capture ;) (because audio is small and audiofilter prefer lossless, and generation loss (multiple transcodes) is actually even more bad for audio, which is why I also upload FLAC to youtube.
Also why is AAC limited to 320 kbit, while AAC encoder actually could go up to 512 kbit?
custom/editable ffmpeg commandline would be epic too!


----------



## Osiris (Dec 11, 2018)

OBS does not use the ffmpeg commandline.


----------



## DeMoN (Dec 11, 2018)

and what about the ffmpeg mode?


----------



## Osiris (Dec 11, 2018)

OBS uses the ffmpeg libraries directly for various things, including Custom output (ffmpeg) mode


----------



## pkv (Dec 12, 2018)

in Custom ffmpeg output mode, the ffmpeg libraries not ffmpeg.exe are used as Osiris said so one can not pass the ffmpeg.exe options BUT one can pass the muxer + video/audio encoder options ; the syntax is option=value with a space separating several options.
All the options in the doc can be used:
https://ffmpeg.org/ffmpeg-formats.html
https://ffmpeg.org/ffmpeg-codecs.html

As to recording to pcm for instance in wav or mkv , this can be done with this custom output.
There is no bitrate restriction either for aac with ffmpeg custom output.

You have to understand that this mode is for experienced / advanced users. If audio bitrate was unbridled in regular modes , everyone would stream stereo audio @1024 kbs which is a non-sense. Even for recording it is a non-sense.
However note that in these regular modes (simple / advanced standard), if one streams/records in surround sound (more than two audio channels) , the bitrate restriction is lifted and one can select up to 1024 kbs.


----------



## DeMoN (Dec 12, 2018)

pkv said:


> Even for recording it is a non-sense.


no for recording lossless makes perfect sense.

Audio filter can work better with lossless audio
and dont forget generation loss

https://en.wikipedia.org/wiki/Generation_loss

So it even makes sense to use lossless audio even for the final video to upload at youtube.
So that Audio at least sees just one lossy encode and not multiple.
Especially on audio generation loss is a topic not to forget.


----------



## pkv (Dec 12, 2018)

DeMoN said:


> no for recording lossless makes perfect sense.
> 
> Audio filter can work better with lossless audio
> and dont forget generation loss
> ...



yes sorry, strike what i said indeed; for recording lossless audio is indeed better, especially if you reprocess audio later


----------

