x264 Options syntax doesn't working

Tomani

New Member
Hey! I'm trying to record/stream using x264, but apparently nothing happens with my custom commands. My recorded file doesn't show my configuration.

My tests:
1)
--level 5.1 --output-depth 10 --output-depth i422 --pass 3 --bitrate 12000 --stats ".stats" --deblock -1:1 --keyint 10 --min-keyint 1 --bframes 16 --b-adapt 2 --ref 16 --weightp 2 --ratetol 0.1 --qcomp 0.4 --aq-mode 2 --aq-strength 1.2 --merange 64 --me umh --direct auto --subme 11 --partitions all --trellis 2 --psy-rd 2.00:1.00 --no-fast-pskip --threads 12
2)
x264-params=level=5.1:output-depth=10:preset=faster:pass=3:bitrate=12000:stats=".stats":threads=12:deblock=-1:1:keyint=10:bframes=16:b-adapt=2:ref=16:weightp=2:ratetol=0.1:qcomp=0.4:rc-lookahead=250:aq-mode=2:aq-strength=1.2:merange=64:me=umh:direct=auto:subme=11:partitions=all:trellis=2:psy-rd=2.00:1.00:no-fast-pskip
3)
--level=5.1 --output-depth=10 --output-depth=i422 --pass=3 --bitrate=12000 --stats=".stats" --deblock=-1:1 --keyint=10 --min-keyint=1 --bframes=16 --b-adapt=2 --ref=16 --weightp=2 --ratetol=0.1 --qcomp=0.4 --aq-mode=2 --aq-strength=1.2 --merange=64 --me=umh --direct=auto --subme=11 --partitions=all --trellis=2 --psy-rd=2.00:1.00 --no-fast-pskip --threads=12

MediaInfo output:
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.2
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 3 min 3 s
Nominal bit rate : 12 000 kb/s
Width : 1 600 pixels
Height : 900 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 60.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.093
Writing library : x264 core 161 r3020 d198931
Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=18 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=120 / keyint_min=12 / scenecut=40 / intra_refresh=0 / rc_lookahead=20 / rc=cbr / mbtree=1 / bitrate=12000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=12000 / vbv_bufsize=12000 / nal_hrd=none / filler=1 / ip_ratio=1.40 / aq=1:1.00

Could someone explain to me how I make my settings work?
Regards!
 

TryHD

Member
what ever you try there will never work, OBS is internally 8 bit so there is no advantage to use 10 bit. And for the other stuff set your encoder x264 to very slow preset. But I don't think there is a CPU that will encode what you set there in real time.
Do you actually know what you do or did you just copy that from somewhere?
 

koala

Active Member
Keep in mind you have 3 input fields for options in OBS: Muxer settings, video encoder settings, audio encoder settings. You need to enter your options in the corresponding options field. If an option is neither muxer, nor video, nor audio, they cannot be used. For example ffmpeg filters cannot be used, and global things like -stats or -threads.
If you call "ffmpeg -h full", you get a huge text output. Valid muxer options have to be in the corresponding "<muxer name> muxer AVOptions" section, valid video encoder options have to be in the corresponding "<video encoder> encoder AVOptions" section. Each option not in these sections is invalid for OBS usage.
 

Tomani

New Member
First of all, thanks for your replys. Appreciate your help.

@TryHD I want to start testing "from above" and balancing down. I know enough about x264 encode, but I want to test it because it is my methodology. I've seen many fallacies about x264 encodes, so I like to venture into various spectrums. I know it's a very heavy setup for streaming, but thanks for your worry.

@R1CH Like this?
level=5.1 pass=3 bitrate=12000 stats=".stats" threads=12
I'm a bit confuse, 'cause the x264 syntax are like my 1) example above. I expected the x264 options would be the same as they are natively used.

@koala Hell huge text! So, with ffmpeg -help encoder=libx264 I get a few possibilities to use but just in record section. As I understand, I won't be able to use FFMPEG commands in a x264 streaming. Right? There is a way to go here? I've used x264 --fullhelp to build my example 1) properly, but I can't understand how the OBS interpret this.
 

Suslik V

Active Member
Neither syntax nor parameters set are correct for OBS.
Before claiming that something doesn't work, please start with Help section of the forum and use search to get your answers.
Example: https://obsproject.com/forum/threads/x264-keys-syntax.110984/post-420559

Also, it is unknown where you trying to apply these "sets". Usually, people attaching log-files to their posts. Where is yours?
 

Tomani

New Member
@Suslik V Your example reply was the first in Google. Not working. I searched in forum and outside. Many divergent explanations and non-functional solutions. I didn't specify where I tested the x264 options because I thought it was obvious, sorry about that.
OBS.png


Log attached. This log from a quick record test is enough?
 

Attachments

  • 2021-07-01 15-10-52.txt
    9.7 KB · Views: 216

Suslik V

Active Member
...Your example reply was the first in Google. Not working...
Try this (now it is for CUSTOM FFmpeg OUTPUT): https://obsproject.com/forum/threads/ffmpeg-video-encoder-setting.77537/#post-329386
No changes in these part of code for a long, if I understand it right. Should work OK.

About your settings
No wonder, the log says x264 param: ... failed.
You mixed rate control methods and x264-params. This syntax will fail for FFmpeg too (OBS uses FFmpeg libs to encode media data).
OBS has special UI entries for Rate Control (obviously it shouldn't be overridden by the user settings), Bitrate, Keyframe etc. These basic controls where given UI in OBS to simplify settings for the users. So, no need to use keys that sets this controls again (crf=... when CBR was set in UI etc.).

And review your testing method - it is better to take small steps rather than make giant leap with short legs. One parameter, if it works - then next one, and so on. I think it is better in this situation.

Something like this (STANDARD recording, should work well, I skipped some controls that already exist in UI or cannot be used, like multi-pass encoding, color planes configuration, color depth etc.):
typed into OBS Output Advanced Settings field named x264 Options (separated by space)
level=5.1 threads=12 deblock=-1:1 bframes=16 b-adapt=2 ref=16 weightp=2 ratetol=0.1 qcomp=0.4 rc_lookahead=250 aq-mode=2 aq-strength=1.2 merange=64 me=umh direct=auto subme=11 partitions=all trellis=2 psy-rd=2.00:1.00 no-fast-pskip
should work for you.


Edit: the statement above is not absolute. Maybe I miss something. They (options) may not work well (or may not work at all). Sorry. I need some rest.
 
Last edited:

Tomani

New Member
@Suslik V thanks a lot, friend! Yesterday I spent my day working around this, did a huge reduce to settings (obviously). Recording it's okay, but live streaming it's a pretty awful due to plataform's bitrate limitations. Unfortunately, 6000kbps (Twitch) needs a compression that x264 can't delivery in real time. Do you have any recommendations for a balanced bigger compression x quality?
 

Suslik V

Active Member
...any recommendations for a balanced bigger compression x quality?
On this forum NVENC was known as king of the encoding (1500-2000$ cards of course):
Not quite sure if this is still valid info.
 
Top