VideoHelp Forum
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. Member
    Join Date
    Nov 2020
    Location
    Casablanca
    Search Comp PM
    I've never heard of it but saw some encoder talking about it in the comments section today so I got curious. can someone explain what's that please? thank you.
    Quote Quote  
  2. In what comments section ?
    It's a quality-based setting in popular open-source video x264 and x265 (possibly others that I'm not aware of). The lower the number, the higher the quality, but also the size of the resulting file ; the higher the number, the lower the file size, but also the quality (more data from the original video is discarded). With x264, a CRF value of 17 usually yields a very high quality, almost indisinguishable from the source ; 20 is usually considered a good compromise ; a CRF set to 0 theoretically produces a lossless compression. At the opposite side of the spectrum, high CRF values above 25 (as used in some popular movie releases from teams with names ending in “...mous” or “...FY” with sizes below 800MB for a full length movie in 1280xXXX resolution or less than 2GB for a 1920xXXX resolution) result in a significant loss of detail, conspicuous banding, and egregious artifacts, especially on dimly lit or fast moving scenes. The advantage over a bitrate-based setting is that the user doesn't have to set a specific bitrate (different sources have different bitrate requirements), the encoder analyses the source based on its own metrics and automatically allocates the bitrate it deems necessary ; the disadvantage is that the final size of the compressed file is not known in advance.
    Quote Quote  
  3. Member
    Join Date
    Nov 2020
    Location
    Casablanca
    Search Comp PM
    thank you for teaching me that, as for the comment section it was on a release by a team called "df...". I'm also curious now if the crf0 works as efficiently in practice as in theory
    Last edited by DiodE; 5th Oct 2021 at 14:40.
    Quote Quote  
  4. MediaInfo reports the encoding parameters if they are embedded in a video file. For instance this :
    Code:
    Encoding settings                        : cabac=1 / ref=4 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.15 
    / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=18 
    / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / 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=50 / rc=2pass / mbtree=1 / bitrate=3000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 
    / qblur=0.5 / vbv_maxrate=62500 / vbv_bufsize=78125 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
    ...indicates that the video was encoded in two passes with a target bitrate of 3000kbps. Whereas this :
    Code:
    Encoding settings                        : cabac=1 / ref=8 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.00 
    / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 
    / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 
    / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 
    / rc_lookahead=60 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    ...indicates that the video was encoded in one pass with a CRF value of 18.

    As for crf=0 being lossless, I didn't do tests to ensure that it is indeed the case, but I can quote this from here (from “jagabo”) :
    For crf=0 both are lossless so both are the same quality.
    Or this from an old thread of mine (from “poisondeathray”) :
    x264 CRF=0 is lossless, but most NLE's don't understand it on import (can't decode it) .
    But even bona fide experts like “lordsmurf” (definitely among the most trusted members here in the specific area of analogic video capture) doubt that it is indeed truly lossless :
    H.264 (including x264/ffmpeg version) is not lossless, period.
    - Less-lossy, sure.
    - Lossless, no.
    But others don't agree, the above opinion is in the minority (from “KarMa”) :
    x264 does support lossless, period. I don't use it for that but it does support it. There's some quibbling over if you need to use CRF=0 or CQ=0 to get lossless, I forget which or maybe both give lossless. But it does support it.
    https://forum.videohelp.com/threads/358901-is-x264lossless-really-lossless
    Also, I've observed on other occasions that a lossless conversion could yield an output not quite faithful to the source, or that two conversions could be different — but in each case other factors were at play. In the world of digital video (as well as in the world in general as a matter of fact) nothing should be taken for granted !
    Last edited by abolibibelot; 5th Oct 2021 at 15:57.
    Quote Quote  
  5. x264 lossless is definitely lossless -- as long as you don't have any color format changes. The people who don't believe this were performing a color format conversion and not realizing it. For example, if you feed the encoder RGB24 it will be converted to YUV 4:2:0 then compressed. On decompression the YUV 4:2:0 video that comes out of the decoder is identical to the YUV 4:2:0 that went in. But if compare to the original RGB24 it will not be identical -- the RGB to YUV and back to RGB conversions are not lossless.

    But CRF 0 is much like other lossless video encoders -- it produces very large files. Someone who's used to CRF 17 encodes will find CRF encodes are ~10 times larger.
    Quote Quote  
  6. CRF is designed to produce a similar visual quality, to encoding with a constant quantiser, but at a lower bitrate.

    There's an overview of x264's rate control methods here.
    https://forum.videohelp.com/threads/381668-would-it-make-more-sense-to-use-1-pass-enco...65#post2470457
    Quote Quote  
  7. Code:
    CRF is designed to produce a similar visual quality,
    note:
    that this only means that the quality is similar throughout your one clip with exactly the settings you use, if you change the clip or a setting all bets are off
    So encoding source A with settings A and encoding source B with settings A can produce wildly different quality even if they use the same crf.
    Also crf does not restict the file size so just because source X came out as 100MB, does not say that source Y (even if it has the same resolution&co) wouldn't come out as 500MB.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  8. Also crf does not restict the file size so just because source X came out as 100MB, does not say that source Y (even if it has the same resolution&co) wouldn't come out as 500MB.
    On that I agree.

    note that this only means that the quality is similar throughout your one clip with exactly the settings you use, if you change the clip or a setting all bets are off
    So encoding source A with settings A and encoding source B with settings A can produce wildly different quality even if they use the same crf.
    But that part puzzles me — isn't that the whole purpose of target quality settings, to produce a similar visual quality regardless of each source's characteristics and specific bitrate requirements ? How could one know in advance which CRF setting to choose for a particular source if it's not at least roughly indicative of the output's quality ? Except for specific issues like banding, in which circumstances would you say that a given CRF setting can produce a “wildly different quality” ? And how could the encoder behave differently for different sources if it manages to behave consistently for all sections of a single source (which can have “wildly different” characteristics and bitrate requirements) ?
    Last edited by abolibibelot; 31st Oct 2021 at 20:14.
    Quote Quote  
  9. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    In math, X - 0 = X and Y - 0 = Y. And X - 0.5X = 0.5X and Y - 0.5Y = 0.5Y, but that doesn't mean X = Y.


    Scott
    Quote Quote  
  10. But that part puzzles me — isn't that the whole purpose of target quality settings,
    The option isn't named 'constant quality', but 'constant rate factor' and rate factor and quality are not the same.
    It's the same with 'constant quantizer', it's also not the same as 'constant quality'.
    crf is no rate control mode that targets a specific quality, it seems like you assume sonething as basis of your thinking which is wrong.
    crf is not something that aims to archive a specific PSRN/SSIM/VMAF/VQA/... value.
    May be reading https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.135.7528&rep=rep1&type=pdf helps a bit or it confuses more.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!