Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th April 2019, 17:29   #1  |  Link
Fishman0919
FishmanMod Android Dev
 
Fishman0919's Avatar
 
Join Date: Apr 2004
Location: Somewhere else, maybe Arizona Bay
Posts: 1,143
x264 Preset settings not correct?

I encode my videos mostly using Preset Slower or Veryslow but I've noticed that the number of --ref frames are not correct. Slower should have --ref 8 and it encodes with --ref 4, veryslow should have --ref 16 but you get --ref 4... and the same for Placebo.

I've noticed this in a few variants of x264... Handbrake/ A.K.A Vidcoder, ffmpeg and x264.exe.

I was wondering, was this changed and not updated in the Full Help or a bug?
__________________
"Cinderella story, out of nowhere,
former greenskeeper, now about
to become the Masters champion.
It looks like a mirac- it's in the hole!"
Fishman0919 is offline   Reply With Quote
Old 15th April 2019, 17:58   #2  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by Fishman0919 View Post
I encode my videos mostly using Preset Slower or Veryslow but I've noticed that the number of --ref frames are not correct. Slower should have --ref 8 and it encodes with --ref 4, veryslow should have --ref 16 but you get --ref 4... and the same for Placebo.

I've noticed this in a few variants of x264... Handbrake/ A.K.A Vidcoder, ffmpeg and x264.exe.

I was wondering, was this changed and not updated in the Full Help or a bug?
Post your complete command line. Some switches, for example "bluray-compat", will override the specified number of ref frames.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 15th April 2019, 18:28   #3  |  Link
Fishman0919
FishmanMod Android Dev
 
Fishman0919's Avatar
 
Join Date: Apr 2004
Location: Somewhere else, maybe Arizona Bay
Posts: 1,143
Quote:
Originally Posted by Groucho2004 View Post
Post your complete command line. Some switches, for example "bluray-compat", will override the specified number of ref frames.
"D:\RipBot264v1.22.0\Tools\ffmpeg\bin\ffmpeg.exe" -loglevel panic -i "C:\Temp\RipBot264temp\job2\job2.avs" -strict -1 -f yuv4mpegpipe - | "D:\RipBot264v1.22.0\tools\x264\x264_x64.exe" --crf 20 --fps 24000/1001 --min-keyint 24 --keyint 240 --frames 111487 --sar 1:1 --level 4.0 --preset veryslow --aq-mode 3 --aq-strength 0.85 --stdin y4m --output "C:\Temp\RipBot264temp\video.264" -

Same settings for the other variants, handbrake and ffmpeg, with same results.


Code:
General
Complete name                            : C:\Temp\RipBot264temp\video.264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 1.86 MiB
Duration                                 : 6 s 757 ms
Overall bit rate                         : 2 308 kb/s
Writing library                          : x264 core 157 r2969 d4099dd
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=3:0.85

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 4 frames
Duration                                 : 6 s 757 ms
Bit rate                                 : 2 308 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.046
Stream size                              : 1.81 MiB (98%)
Writing library                          : x264 core 157 r2969 d4099dd
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=3:0.85
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
__________________
"Cinderella story, out of nowhere,
former greenskeeper, now about
to become the Masters champion.
It looks like a mirac- it's in the hole!"

Last edited by Fishman0919; 15th April 2019 at 18:35.
Fishman0919 is offline   Reply With Quote
Old 15th April 2019, 18:40   #4  |  Link
Fishman0919
FishmanMod Android Dev
 
Fishman0919's Avatar
 
Join Date: Apr 2004
Location: Somewhere else, maybe Arizona Bay
Posts: 1,143
without aq-mode 3

"D:\RipBot264v1.22.0\Tools\ffmpeg\bin\ffmpeg.exe" -loglevel panic -i "C:\Temp\RipBot264temp\job2\job2.avs" -strict -1 -f yuv4mpegpipe - | "D:\RipBot264v1.22.0\tools\x264\x264_x64.exe" --crf 20 --fps 24000/1001 --min-keyint 24 --keyint 240 --frames 111487 --sar 1:1 --level 4.0 --preset veryslow --stdin y4m --output "C:\Temp\RipBot264temp\video.264" -


Code:
General
Complete name                            : C:\Temp\RipBot264temp\video.264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 1.10 MiB
Duration                                 : 4 s 546 ms
Overall bit rate                         : 2 025 kb/s
Writing library                          : x264 core 157 r2969 d4099dd
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 4 frames
Duration                                 : 4 s 546 ms
Bit rate                                 : 2 025 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.041
Stream size                              : 1.07 MiB (97%)
Writing library                          : x264 core 157 r2969 d4099dd
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
__________________
"Cinderella story, out of nowhere,
former greenskeeper, now about
to become the Masters champion.
It looks like a mirac- it's in the hole!"
Fishman0919 is offline   Reply With Quote
Old 15th April 2019, 18:52   #5  |  Link
Andouille
Registered sausage
 
Andouille's Avatar
 
Join Date: May 2012
Posts: 78
IIRC level 4.0 only supports 4 ref frames for 1920x1080.
AND you are forcing 4.0 level...
Andouille is offline   Reply With Quote
Old 15th April 2019, 18:59   #6  |  Link
Fishman0919
FishmanMod Android Dev
 
Fishman0919's Avatar
 
Join Date: Apr 2004
Location: Somewhere else, maybe Arizona Bay
Posts: 1,143
no, only difference between level 4.0 and 4.1, that I know of, is --vbv-bufsize and --vbv-maxrate


"D:\RipBot264v1.22.0\Tools\ffmpeg\bin\ffmpeg.exe" -loglevel panic -i "C:\Temp\RipBot264temp\job2\job2.avs" -strict -1 -f yuv4mpegpipe - | "D:\RipBot264v1.22.0\tools\x264\x264_x64.exe" --crf 20 --fps 24000/1001 --min-keyint 24 --keyint 240 --frames 111487 --sar 1:1 --level 4.1 --preset veryslow --stdin y4m --output "C:\Temp\RipBot264temp\video.264" -

Code:
General
Complete name                            : C:\Temp\RipBot264temp\video.264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 1 000 KiB
Duration                                 : 4 s 254 ms
Overall bit rate                         : 1 926 kb/s
Writing library                          : x264 core 157 r2969 d4099dd
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 4 frames
Duration                                 : 4 s 254 ms
Bit rate                                 : 1 926 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.039
Stream size                              : 1 000 KiB (100%)
Writing library                          : x264 core 157 r2969 d4099dd
Encoding settings                        : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
__________________
"Cinderella story, out of nowhere,
former greenskeeper, now about
to become the Masters champion.
It looks like a mirac- it's in the hole!"

Last edited by Fishman0919; 15th April 2019 at 19:04.
Fishman0919 is offline   Reply With Quote
Old 15th April 2019, 19:16   #7  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by Fishman0919 View Post
no, only difference between level 4.0 and 4.1, that I know of, is --vbv-bufsize and --vbv-maxrate
Level 4.1:
1080p: 4 refs
720p : 9 refs
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 15th April 2019, 19:21   #8  |  Link
Fishman0919
FishmanMod Android Dev
 
Fishman0919's Avatar
 
Join Date: Apr 2004
Location: Somewhere else, maybe Arizona Bay
Posts: 1,143
Quote:
Originally Posted by Groucho2004 View Post
Level 4.1:
1080p: 4 refs
720p : 9 refs
Yes, just found that... Thank You!
__________________
"Cinderella story, out of nowhere,
former greenskeeper, now about
to become the Masters champion.
It looks like a mirac- it's in the hole!"
Fishman0919 is offline   Reply With Quote
Old 24th April 2019, 17:36   #9  |  Link
zub35
Registered User
 
Join Date: Oct 2016
Posts: 56
ref=MaxDpbMbs/(x*y) - we round down (if 4.99 then 4)
x=width/16 | y=height/16 - we round up (if 80.01 then 81)

level - MaxDpbMbs
3.0 - 8100 (480p30)
3.1 - 18000 (720p30)
3.2 - 20480 (720p60)
4.0 - 32768 (1080p30)
4.1 - 32768 (1080p30)
4.2 - 34816 (1080p60)
5.0 - 110400 (2560x1920p30)
5.1 - 184320 (2160p30)
5.2 - 184320 (2160p60)

level - vbv-maxrate and vbv-bufsize (Profile: Baseline-Main | High | High 10 | High 422-444)
3.0 - 10000 12500 30000 40000
3.1 - 14000 17500 42000 56000
3.2 - 20000 25000 60000 80000
4.0 - 20000 25000 60000 80000
4.1 - 50000 62500 150000 200000
4.2 - 50000 62500 150000 200000
5.0 - 135000 168750 405000 540000
5.1 - 240000 300000 720000 960000

If you specify a --level and --preset, then the --ref is calculated automatically!
but no more than stipulated by --preset


It is strange that the codec does not do automatic --vbv-maxrate and --vbv-bufsize, if --level and --profile (and --bluray-compat) is specified
This will help to avoid many problems when a low CRF value is indicated.

Last edited by zub35; 24th April 2019 at 18:24.
zub35 is offline   Reply With Quote
Old 24th April 2019, 21:33   #10  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by zub35 View Post
level - vbv-maxrate and vbv-bufsize (Profile: Baseline-Main | High | High 10 | High 422-444)
3.0 - 10000 12500 30000 40000
3.1 - 14000 17500 42000 56000
3.2 - 20000 25000 60000 80000
4.0 - 20000 25000 60000 80000
4.1 - 50000 62500 150000 200000
4.2 - 50000 62500 150000 200000
5.0 - 135000 168750 405000 540000
5.1 - 240000 300000 720000 960000
Those are the vbv maxrate values only. vbv bufsize can be different.

Attached Images
 

Last edited by sneaker_ger; 24th April 2019 at 21:35.
sneaker_ger is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.