Question / Help I thought this would be over...but it's not. YouTube Encoding

PrinceVinc

Member
I use OBS for Local recording following this guide here:
https://obsproject.com/forum/resources/how-to-make-high-quality-local-recordings.16/

The Output looks really good but filesize is to huge so I also use Handbrake for lowering the size but there is a Problem.

It seem to make no Difference wich file I upload I get a strange "picture" every few seconds on YT
I tried Averagebitrate 12000kbps 2-Pass (8000kbps are recommended by YT for 1080p) and CRF=20 with the following settings in handbrake:
Keyintervall -> keyint=24 (YT for 48FPS):
rc-lookahead=60(just cause):
Reference Frames -> ref=4: (compression)
B-Frames -> bframes=2 (YT reccommends)
Optmierung von B frames -> :b-adapt=2: and direct=auto Higher Quality b-frames

The results all look the same:
https://www.youtube.com/watch?v=2URGN9OdvR8

An what bothers me is what happen here -> it randomly goes blurry, sharp, blurry, sharp as If the quality settings is changed every few seconds but I doesn't in fact, so what could be the Problem? How can I prevent this?
Or is Hanbrake just suboptimal for that matter?
 
I use OBS for Local recording following this guide here:
https://obsproject.com/forum/resources/how-to-make-high-quality-local-recordings.16/

The Output looks really good but filesize is to huge so I also use Handbrake for lowering the size but there is a Problem.

It seem to make no Difference wich file I upload I get a strange "picture" every few seconds on YT
I tried Averagebitrate 12000kbps 2-Pass (8000kbps are recommended by YT for 1080p) and CRF=20 with the following settings in handbrake:
Keyintervall -> keyint=24 (YT for 48FPS):
rc-lookahead=60(just cause):
Reference Frames -> ref=4: (compression)
B-Frames -> bframes=2 (YT reccommends)
Optmierung von B frames -> :b-adapt=2: and direct=auto Higher Quality b-frames

The results all look the same:
https://www.youtube.com/watch?v=2URGN9OdvR8

An what bothers me is what happen here -> it randomly goes blurry, sharp, blurry, sharp as If the quality settings is changed every few seconds but I doesn't in fact, so what could be the Problem? How can I prevent this?
Or is Hanbrake just suboptimal for that matter?
First, start over, remove all custom x264 settings, ALL

Post your logfile from the help menu. http://media.giphy.com/media/xTiTnjgTE4Gfptqvg4/giphy.gif

to many custom x264 settings often make things worse than better. if you are recording at 48fps, just set key frame interval to 2 (same as saying keyint 96) and remove the keyint=24 the custom x264 which is what you want. this is why you are getting the blurry, sharp plug the huge filesize, to many IDR frames,

every 24 frames which is twice a second, IDR frames cannot be compressed so explains the huge filesize.

If you are to be using custom x264 settings, dont just copy-pasta, research your settings.



EDIT: What you were probably thinking was YT recommends a closed GOP of the 1/2 fps (24 in your case). GOP and IDR are two separate things. dont worry about GOP and let x264 do the work for you.
 
Oh no you got that wrong xD those special settings are only in Handbrake!
The OBS settings are as you said:
https://gist.github.com/86488ed9ee366c4c1c66
This log file is new tested 2k recording and set the FPS accordingly to 30 but other than that no change.

And the Handbrake settings I found and researched here/got pointed at: https://support.google.com/youtube/answer/1722171?hl=en
Video codec: H.264
  • Progressive scan (no interlacing)
  • High Profile (did too)
  • 2 consecutive B frames (I did)
  • Closed GOP. GOP of half the frame rate. thats why keyint is 24 48 is fps so half of that is 24
  • CABAC is checked
  • Variable bitrate. No bitrate limit required, though we offer recommended bit rates below for reference
 
Last edited:
Oh no you got that wrong xD those special settings are only in Handbrake!
The OBS settings are as you said:
https://gist.github.com/86488ed9ee366c4c1c66
This log file is new tested 2k recording and set the FPS accordingly to 30 but other than that no change.

And the Handbrake settings I found and researched here/got pointed at: https://support.google.com/youtube/answer/1722171?hl=en
Video codec: H.264
  • Progressive scan (no interlacing)
  • High Profile (did too)
  • 2 consecutive B frames (I did)
  • Closed GOP. GOP of half the frame rate. thats why keyint is 24 48 is fps so half of that is 24
  • CABAC is checked
  • Variable bitrate. No bitrate limit required, though we offer recommended bit rates below for reference

GOP is not the same as keyframes aka keyint aka IDR. set keyint in handbreak to 96 and I bet the blur is gone and will also reduce your filesizes and increase compression

1440 video will be large anway but when you set your Intra-refresh to half your fps, it sends a RAW uncompressed frame twice a second, which will reduce the amount of b and p frames.
 
But as I said my RAW file from OBS has Keyint every 2 Seconds but it has the same Problem if it is up on YT
blur sharp blur sharp
What means the GOP setting in YT then?

Edit:
This is what the raw file looks like 1080p48
https://www.youtube.com/edit?o=U&video_id=a6UCy0I3hxc

Strange It seems when I encode it again with Handbrake and a Keyint of 96 the behaviour is indeed different.
What should I set the Keyint in Handbrake than? The default h264 is keyint=250 wich would be about 8sec for 30FPS and about 4 for 60FPS so I guess I should adjust them right?

Edit: Nope it's not same as before
https://www.youtube.com/watch?v=32kS7LkPxSU

So what Options should/can I set to prevent this sharp blur sharp blur behavior in Handbrake?
Other can manage that too, but they also use cutting software I just recode it with Handbrake.
Or is there just no way for me?

Are the b-frames setting correct in handbrake?
bframes=2: b-adapt=2: direct=auto
 
Last edited:
I prepared another Video with 6 Ref, 5 B-Frames (Optimal & Automatic) and 12000kbps 2-pass encoding everything else is by default. The result looks just meh on YouTube :P
https://www.youtube.com/watch?v=fDZ0jOAwWiE
The RAW File put out by OBS looks the same:
https://www.youtube.com/watch?v=JOuH4rY_CVE (Start at 4:37!)

So what goes wrong? Why I can't have a consistent Image?

On my PC-Player both looks great :/

This Video here for Example the Quality looks very consistent! No random drops, partly the quality is not as sharp but it's not so obvious to see like in my Videos:
https://www.youtube.com/watch?v=_--X9a2U5EM
 
Last edited:
Just do this. It's how I prepare all my OBS videos (if I need to) when I run them through handbrake (though I usually don't need to). I've tried various combinations of settings from adjusting the encoding profile and the levels and the compression and even trying to force an average bitrate, and all it has done is increase my filesize and leave quality the same. If you have colour correction etc that you want to add afterward, go ahead. But that's all you need for good videos and I get no issues with any videos I run through that.
Screenshot1680.jpg
 
As I said if I Upload the RAW footage or the Handbrake compressed it makes no difference on the outcome in YT.
(Except for filesize aka smaller)
Can you give some examples of your Videos and a Logfile along the line?
 
As I said if I Upload the RAW footage or the Handbrake compressed it makes no difference on the outcome in YT.
(Except for filesize aka smaller)
Can you give some examples of your Videos and a Logfile along the line?
15,000 bitrate, 25,000 buffer size. 10 quality balance. NVENC.
"high quality" preset. Encoding profile "high". No custom x264 settings, "0" for keyframe interval. Use CFR is not checked, neither is "Encode in Full Range".

Example here: https://www.youtube.com/watch?v=pQw280_hC4Q

The settings are for 1080/60, and that video was recorded as such, but the game was running at 30fps locked, so don't worry if it doesn't look "60fps smooth".
 
Are you just taking your OBS files and then running it through Handbrake, and then uploading to YouTube? Or is there some editing or something else you do to the video in there as well?

If you're not doing anything else to the video other than using Handbrake to reduce its file size, you may as well just configure OBS to save it that way from the get-go.

If you're editing the videos first, or cropping them, or something like that, then you should save your files as in the High Quality Local Recordings guide you linked.

If you're not editing them, then you should adjust your OBS settings so that the file size is where you like it before uploading to YouTube, to avoid a re-encode step. This would mean increasing your CRF value to make the file size smaller. And configuring OBS to output files like YouTube likes to receive them.

Note if you use Handbrake, don't do this, but if you upload to YouTube directly from OBS output, then DO do this. I wrote some quasi-instructions here when figuring this out for the first time: https://obsproject.com/forum/thread...lity-local-recordings.12600/page-4#post-46066

I've also made a feature request to make this easier on people, but no dev was interested in it, or they were already more worried about the multiplatform version by then, not sure: https://obsproject.com/forum/threads/allow-key-interval-setting-of-1-2-second.9872

I prepared another Video with 6 Ref, 5 B-Frames (Optimal & Automatic) and 12000kbps 2-pass encoding everything else is by default. The result looks just meh on YouTube :P
https://www.youtube.com/watch?v=fDZ0jOAwWiE
The RAW File put out by OBS looks the same:
https://www.youtube.com/watch?v=JOuH4rY_CVE (Start at 4:37!)

So what goes wrong? Why I can't have a consistent Image?

On my PC-Player both looks great :/

The problem I see in those YouTube videos isn't a GOP or Keyframe interval problem, its a problem of too little bitrate once things start moving fast. Hate to say it, but if you want that to look better, you're going to have to deal with larger file uploads to YouTube, and not try to decrease the file size first.

09:00:11: Using graphics capture
09:00:11: Trying to hook process: witcher3.exe
09:00:11: Scene buffering time set to 700
09:00:11: Using custom x264 settings: "crf=22"
09:00:11: x264: VBV maxrate specified, but no bufsize, ignored
09:00:11: ------------------------------------------
09:00:11: Video Encoding: x264
09:00:11: fps: 30
09:00:11: width: 2560, height: 1440
09:00:11: preset: veryfast
09:00:11: profile: high
09:00:11: keyint: 60
09:00:11: CBR: no
09:00:11: CFR: yes
09:00:11: max bitrate: 1000
09:00:11: buffer size: 0
09:00:11: quality: 10
09:00:11: ------------------------------------------
09:00:11: Using ReplayBuffer with a length of 10 seconds
09:06:03: FlushBufferedVideo: Flushing 3 packets over 66 ms
09:06:03: Total frames encoded: 10530, total frames duplicated: 2537 (24.09%)
09:06:03: Total frames rendered: 10528, number of late frames: 9 (0.09%) (it's okay for some frames to be late)

You're duplicating almost 1/4th of your frames. That's... not good. Your computer can't come even close to handling what you're asking it to do. You're running at a high resolution (1440p), so you could try downscaling to 1080p. You could also try using SuperFast preset. Or both. And I also have to revoke my previous advice and instead advise you to lower your CRF for the previously mentioned problem: too little bitrate. You're just going to have to deal with longer uploads to YouTube if you want those quality problems to go away.
 
Last edited:
But as I said my RAW file from OBS has Keyint every 2 Seconds but it has the same Problem if it is up on YT
blur sharp blur sharp
What means the GOP setting in YT then?

Edit:
This is what the raw file looks like 1080p48
https://www.youtube.com/edit?o=U&video_id=a6UCy0I3hxc

Strange It seems when I encode it again with Handbrake and a Keyint of 96 the behaviour is indeed different.
What should I set the Keyint in Handbrake than? The default h264 is keyint=250 wich would be about 8sec for 30FPS and about 4 for 60FPS so I guess I should adjust them right?

Edit: Nope it's not same as before
https://www.youtube.com/watch?v=32kS7LkPxSU

So what Options should/can I set to prevent this sharp blur sharp blur behavior in Handbrake?
Other can manage that too, but they also use cutting software I just recode it with Handbrake.
Or is there just no way for me?

Are the b-frames setting correct in handbrake?
bframes=2: b-adapt=2: direct=auto
Ok, my mistake, you said in OP that every thing with the RAW was fine.

The Output looks really good but filesize is to huge so I also use Handbrake for lowering the size but there is a Problem.

Why are you reencoding to 1080@48fps from 1440@30. you cant add frames that aren't there async like that. if you record with OBS 1080@30 then upload at the same
 
the log files of mine are messed up it seems that was a 1080p48 recording >.<
And how can It be that the bitrate on my raw file is to low? The lower the CRF the more bitrate is needed the higher the Quality goes correct?
So if I increase my CRF to say 30 the Quality would drop even further or not? (the file size smaller too)
But You said before I have a to low bitrate!

And Yeah I would like to use the direct output from OBS I record parts and add them together. (without re-encoding)
I used Handbrake as the only "editing" thing to decrease Filesize whil maintaining Quality, at least I hoped I did this with 2-pass encoding.

I just read in your Thread about QP isn't that what I need?

Edit: Nope, the exact same behavior as CRF.

It doesn't matter if I use Handbrake or not, it looks the exact same!
The only difference is the filesize Handbrake smaller < OBS bigger.
Both looks on my Videoplayer perfect, no visible difference!
There seems to be either something strange with OBS or YT like some sort of trick everyone uses but me.

I mean what difference is it when you re-encode a video after editing?

The compression paramter are the same or not?

https://www.youtube.com/watch?v=zkZLP8TdYmQ

Even this with only 720p looks more consistent in Quality than mine...
 
Last edited:
If you use Handbrake, don't use 2-pass encoding, its not as good, and YouTube wants a variable bitrate upload anyways, so there's no point to go through the extra effort.

But don't use Handbrake, just use OBS, and set the CRF lower. I initially said higher, because you wanted a smaller upload, but then I said:
And I also have to revoke my previous advice and instead advise you to lower your CRF for the previously mentioned problem: too little bitrate. You're just going to have to deal with longer uploads to YouTube if you want those quality problems to go away.

And dping is right, what you said about 48fps doesn't make any sense at all given what we see in your OBS log. You've recorded at 30fps, so stay at 30fps if you use Handbrake (which you shouldn't need to do anyways). Don't say the log files are messed up, I believe a log file more than I believe you, no offense. Either you uploaded the wrong log file, or you're mistaken about recording at 48fps.

If you're still having problems, then I'll need a new OBS log from your most recent attempt after you make the changes recommended.
 
The log file wasn't messed up it was simply not there/wrong one -> found it https://gist.github.com/anonymous/8322a25432f4b08098ca

So the recordings where made 1080p48 and reencoded as such I uploaded the RAW file and Handbrake compressed file, both have the same Issue at the same time ON YouTube!
In the player itself everything is fine.
Maybe I should only record 30fps to have more bytes left for the whole image? I play@50-60FPS Average 55
But then again It wouldn't look smooth anymore :/ but it seems it doesn't on YT anyway xD

2-pass (Averagebitrate) or 1-pass(CRF) encoding has no visual effect on the YT Image, the difference lies wthin the file size 2-pass much smaller and the bytes are allocated where they are needed.

It works quite good on some materials that had 30000kbps+ Average and reduced it to 12000kbps Average without any visual loss for my eyes. (PC or YT)
 
The log file wasn't messed up it was simply not there/wrong one -> found it https://gist.github.com/anonymous/8322a25432f4b08098ca

So the recordings where made 1080p48 and reencoded as such I uploaded the RAW file and Handbrake compressed file, both have the same Issue at the same time ON YouTube!
In the player itself everything is fine.
Maybe I should only record 30fps to have more bytes left for the whole image? I play@50-60FPS Average 55
But then again It wouldn't look smooth anymore :/ but it seems it doesn't on YT anyway xD
Two questions:

Sure, do a test at 1080@30 and compare the results. dont use handbrake til at least we pinpoint the issue. MAybe try crf=15
 
Last edited:
Does YT even take CRF in consideration? https://gist.github.com/anonymous/1d641b7d51b5b6de07a5
bframes=2 CRF=15 as suggested

Seems I have a problem with duplicated frames (over 6%) that means my cpu is not fast enough right?
I have a i7-4790k and the CPU Usage while recording is about ~80%
I never said bframes=2 :-S your files will be bigger but you could try super fast preset OR use the VCE build of OBS. that will take all the pressure from the CPU and put it on your R9 290X

https://obsproject.com/forum/threads/obs-branch-with-amd-vce-support.13996/page-90#post-140289

the current issues with this build is there is a problem with streaming with b frames, but I think local recording is alright and you cant use buffer 0 with this build. there is alternatives though.
 
Back
Top