Question / Help FFmpeg output mode doesn't use b frames with NVENC

Hello.
I don't know why, but it seems there is no b frames. (checked via shana encoder. there were only I and P frames. advanced output had b frames.)
Parameter I tired are
-preset slow -level 0 -rc vbr_hq -rc-lookahead 32 -qp 0 -cq 0 -bf 3 -2pass 1 -no-scenecut 1 -b_adapt 0 -weighted_pred 1 -b_ref_mode 2
And obs setting is 144Mbps, keyframe interval is 64 which is 1 second, 4:4:4 chroma subsampling.
From that parameters, remove some values and tested. but there were no b frames, I also put delay parameter , but same result.
Is there any way enable b frames with ffmpeg output mode with nvenc?
There were no ffmpeg parameters in log so it looks not helping, but put it
Thank you.
 

Attachments

  • 2019-02-26 15-41-06.txt
    32.2 KB · Views: 95

Suslik V

Active Member
If you forcing high444 profiles (by setting qp at 0), then encoder cannot use B-frames. It obvious.
Wanna get lossless or what?
 
If you forcing high444 profiles (by setting qp at 0), then encoder cannot use B-frames. It obvious.
Wanna get lossless or what?
I thought It was minimum quantize value. so with higher motion, more quantization. but... NVENC doesn't support CRF, right? then I should remove qp value.
But, yes, I hope to use lossless rate control, but, it is quite hard for maxwell 2nd generation NVENC.
-
Hmm... I have no idea why b frames aren't used. -preset slow -level 0 -rc vbr_hq this doesn't work neither.
 
Last edited:

Zidakuh

Member
For reasons unknown, my experience with FFMPEG in OBS requires me to use the x264 parameters rather than FFMPEG's parameters.
These parameters being "parameter=value" space for seperation. (e.g. bframes=4 rc-lookahead=30 etc.)
 
1551256880491.png

--enable nvenc -preset slow -level 0 -rc vbr_hq -coder cabac -rc-lookahead 32 -cq 0 -bf 3 -g 256 -no-scenecut 1 -b_adapt 0 -weighted_pred 1 -b_ref_mode 2 -bluray-compat 0 -spatial-aq 1 -temporal-aq 1

For reasons unknown, my experience with FFMPEG in OBS requires me to use the x264 parameters rather than FFMPEG's parameters.
These parameters being "parameter=value" space for seperation. (e.g. bframes=4 rc-lookahead=30 etc.)
Thank you for the solution, but it didn't work for me

-

BTW, before OBS 23(22), simple mode with 4:4:4 high just did work with b frames, so I think there is no problem with my graphics card, and my card is maxwell generation, my graphics driver is not to date, but it is the latest version of windows update catalog. do I need to update?

General
Unique ID : 50124512786037131537524827979379232581 (0x25B5A1487B844324C932132FE0B9CF45)
Complete name : Z:\OBS\OBS 2019 02 27 17 48 58.mkv
Format : Matroska
Format version : Version 4 / Version 2
File size : 46.5 MiB
Duration : 41 s 188 ms
Overall bit rate mode : Variable
Overall bit rate : 9 466 kb/s
Writing application : Lavf57.84.100
Writing library : Lavf57.84.100 / Lavf57.84.100
ErrorDetectionType : Per level 1

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 4:4:4 Predictive@L5.1
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=64
Codec ID : V_MPEG4/ISO/AVC
Duration : 41 s 189 ms
Bit rate mode : Variable
Maximum bit rate : 144 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 64.168 FPS
Original frame rate : 64.000 FPS
Color space : YUV
Chroma subsampling : 4:4:4
Bit depth : 8 bits
Scan type : Progressive
Default : Yes
Forced : No
Color range : Full
Matrix coefficients : BT.709
DURATION : 00:00:41.188000000
 
Last edited:

Zidakuh

Member
Sidenote, no need to add the "--enable nvenc" when the nvenc specific encoder is allready selected. You can even see that it uses the hardware chip in the taskmanager if you are ever in doubt.
 
Thank you for replies.
But, just in case, I installed the latest driver for video codec SDK 9, but still GOP M=1.
Also I tried preset=hq rc=vbr if 2pass make b-frames not being used, but it is same. I don't what did I do wrong.
I think I can't solve the problem. so... lastly, can I get some recommendation of video encoder setting to achieve the setting image below?
Also not using b-frame, how much is it make look different?
1551273938274.png

I hope there is Custom Audio Output (ffmpeg) option in standard output type.
 

Zidakuh

Member
I believe that rc-lookahead and bframes do not work together. I have a detailed list of options and explanations here.

Edit:
If you want more reference frames (ReFrames) you have to bug FFMPEG devs to expose it. OBS in streaming/stanard recording allows for a maximum of 2 ReFrames, while the FFMPEG implementation allows for only one. No setting or parameter can change this,before it's implemented in FFMPEG itself.
 

Suslik V

Active Member
The issue that I can't use b-frames...
All your examples and media info shows that you are trying to use incompatible parameters set.

Here is link to the guide: OBS-Studio: High quality recording and multiple Audio Tracks
But first, make new Profile in OBS Studio to use default settings of the application.

The screenshot settings (posted few posts above) can be emulated with the next string (Video Encoder Settings field):
rc=vbr preset=mq profile=high bf=3
or it means:
-rc vbr -preset hq -profile high -2pass true -rc-lookahead 0 (rc-lookahead with value of 8 is mentioned only in SDK-based implementation of the encoder, so you cannot use it here, 2pass will be overridden if mq not mentioned - this was intentional move in the obs code during changes in FFmpeg itself, and bf here means B-frames - parameter that will be used in the obs itself just to set some options of the encoder internally).
Don't forget to specify bitrate at Video Bitrate field. Set Keyframe interval (frames) to your output FPS. All other parameters already set by default.
It may work slightly slower because, as I understand, this screenshot from the new SDK-based implementation of the encoder not FFmpeg's one.

I don't have hardware to test if the order of the parameters is correct but I think it should work well.

And again, you are doing something wrong if you need Custom Output (FFmpeg) of OBS Studio for such casual task as multi-track recording.
 
Thank you for replies, all of you.
But, sadly, rc=vbr preset=mq profile=high bf=3 , this, didn't work for me. but it looks quite correct. according to source code.(actually, I don't know how to read codes.)
Just in case, put a space at the start of params, I tried removing some params, preset=mq bf=3, rc=vbr preset=mq bf=3,and change parameter order, preset=mq rc=vbr profile=high bf=3.
So, maybe my machine is corrupted somehow? so I gonna ask someone to test these params, or remote control. after then, I need to think what to do.
BTW, any H.264 encoders contain 'NVENC' word are all same? (to me, there are h264_nvenc, nvenc, nvenc_h264) what's the different among them?
-
The reason I try to use ffmpeg output mode is, I want to record multi-tracks as lossless codec. although I installed CoreAudio encoder, and I know it doesn't make different hearing at all, but I like to record as lossless. at least, I use audio interface, then fair point, right?
 
Last edited:

Suslik V

Active Member
The encoder profile is high444p - what you expected? You didn't make new obs Profile, so Advanced Settings of the application still at I444, I think.
 
The encoder profile is high444p - what you expected? You didn't make new obs Profile, so Advanced Settings of the application still at I444, I think.
About that, I tried it with new profile with I444 color format, also I tried portable mode, but that didn't work.
Also I made a new profile, and just leave almost of them as default(30fps, NV12, 30 key frame). but it didn't as well.
Encoder built-in player doesn't show b-frame as well.

1551366377847.png

1551366391742.png

1551366404132.png

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.1
Format settings, CABAC : Yes
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=30
Codec ID : V_MPEG4/ISO/AVC
Duration : 32 s 726 ms
Bit rate mode : Variable
Maximum bit rate : 144 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 30.068 FPS
Original frame rate : 30.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Default : Yes
Forced : No
Color range : Limited
Matrix coefficients : BT.601
DURATION : 00:00:32.733000000
 
Last edited:

Zidakuh

Member
MediaInfo doesn't show bframes when the video is encoded with NVENC. It can't.
You will need some other tool to do that.
 
Top