VideoHelp Forum

+ Reply to Thread
Results 1 to 11 of 11
Thread
  1. I encoded video (1.5mb mpeg-2) in H264 (it became 750kb), with help of the tuned x264, and after a detailed check of each pixel in different frames and scenes I saw that after compression in 2 times quality was not lost at all. Only places where it was lost are blocks. How to disable deblocking? What parameters are missing?

    ffmpeg -i ivtced.yuv -aspect 640:480 -c:v libx264 -tune zerolatency -preset placebo -crf 16 -refs 4 -me_range 64 -bf 16 -trellis 1 -subq 9 -qcomp 0 -x264-params no-deblock videocutted.h264

    Left window - original, right window - re-encoded
    Image
    [Attachment 46754 - Click to enlarge]
    Last edited by Megafox; 21st Sep 2018 at 13:50.
    Quote Quote  
  2. Are you sure you want to disable deblocking completely , not just modulate the alpha/beta strength ?


    Code:
    -x264opts no-deblock
    Quote Quote  
  3. Originally Posted by poisondeathray View Post
    Are you sure you want to disable deblocking completely , not just modulate the alpha/beta strength ?


    Code:
    -x264opts no-deblock
    Thank you very much. That helped. However, this was not enough for me and I had to disable AQ, and set qp to 14 to achieve exactly same quality (size is less than original by 1% due to removal of noise on a black background). Now I have another question: how to disable denoiser (black)?

    Command:

    ffmpeg -i videocutted.mpg -aspect 640:480 -c:v libx264 -tune zerolatency -preset placebo -qp 14 -refs 4 -me_range 64 -bf 16 -trellis 1 -subq 9 -qcomp 0 -aq-mode 0 -x264opts no-deblock videocutted.h264

    Image
    [Attachment 46755 - Click to enlarge]
    Quote Quote  
  4. It's not "exactly" the same quality . Use a lower qp , higher bitrate or higher crf if you want it closer to the same quality . Of course filesize will increase . In the end, bitrate is the most important (lower qp's if that's what you're using)

    To disproportionately distribute more bitrate to flat and darker areas, you actually need to use AQ (if using bitrate or crf rate control, it's disabled if you're using -qp) . qp with a qcomp of 0 tends to be less efficient, but I know you're trying to be close to visually lossless . In that case you can't get around using lower qp's . A fixed qp with qcomp 0 will be less efficient in general (you need larger filesize)

    To retain fine noise on black backgrounds (or any fine noise) you usually have to reduce deadzone values , but at some ponit a low enough qp will also do it
    Quote Quote  
  5. Originally Posted by poisondeathray View Post
    It's not "exactly" the same quality . Use a lower qp , higher bitrate or higher crf if you want it closer to the same quality . Of course filesize will increase . In the end, bitrate is the most important (lower qp's if that's what you're using)

    To disproportionately distribute more bitrate to flat and darker areas, you actually need to use AQ (if using bitrate or crf rate control, it's disabled if you're using -qp) . qp with a qcomp of 0 tends to be less efficient, but I know you're trying to be close to visually lossless . In that case you can't get around using lower qp's . A fixed qp with qcomp 0 will be less efficient in general (you need larger filesize)

    To retain fine noise on black backgrounds (or any fine noise) you usually have to reduce deadzone values , but at some ponit a low enough qp will also do it
    Parameters deadzone, deadzone-intra and deadzone-inter are not in ffmpeg. How else can I turn it off?

    ffmpeg -i videocutted.mpg -aspect 640:480 -c:v libx264 -preset placebo -qp 15.5 -refs 16 -me_range 64 -bf 16 -trellis 0 -subq 10 -qcomp 0 -aq-mode 0 -x264opts no-deblock -x264-params no-dct-decimate=1 videocutted.h264
    Quote Quote  
  6. Originally Posted by Megafox View Post
    Parameters deadzone, deadzone-intra and deadzone-inter are not in ffmpeg. How else can I turn it off?

    ffmpeg -i videocutted.mpg -aspect 640:480 -c:v libx264 -preset placebo -qp 15.5 -refs 16 -me_range 64 -bf 16 -trellis 0 -subq 10 -qcomp 0 -aq-mode 0 -x264opts no-deblock -x264-params no-dct-decimate=1 videocutted.h264
    almost anything that isn't included in ffmpeg libx264 directly can usually be specified through -x264opts . You can include no-dct-decimate too instead of using both -x264opts and -x264-params . Separate switches are separated by a colon

    default values for deadzone-inter and deadzone-intra are 21 and 11 respectively . Lower values will preserve more fine detail, but result in larger filesizes. Like everything , it's a tradeoff. If you look at the tune grain preset it's set to 6 and 6 .
    Code:
    -x264opts no-deblock:deadzone-inter=6:deadzone-intra=6:no-dct-decimate
    preset placebo already specifies 16 reference frames, 16 bframes, so those are redundant commands in your command line .
    Quote Quote  
  7. I have strong impression that parameters within x264opts must be passed in strict form like
    Code:
    -x264opts="no-deblock=1"
    Quote Quote  
  8. Originally Posted by pandy View Post
    I have strong impression that parameters within x264opts must be passed in strict form like
    Code:
    -x264opts="no-deblock=1"
    -x264opts does not require it for boolean parameters. If you would have checked , you would see that both no-deblock and no-dct-decimate are passed in the example above . It behaves more like x264cli syntax (that's why I prefer it when using ffmpeg libx264) . x264-params behaves more like ffmpeg syntax (key=value) .
    Quote Quote  
  9. Originally Posted by poisondeathray View Post
    Originally Posted by Megafox View Post
    Parameters deadzone, deadzone-intra and deadzone-inter are not in ffmpeg. How else can I turn it off?

    ffmpeg -i videocutted.mpg -aspect 640:480 -c:v libx264 -preset placebo -qp 15.5 -refs 16 -me_range 64 -bf 16 -trellis 0 -subq 10 -qcomp 0 -aq-mode 0 -x264opts no-deblock -x264-params no-dct-decimate=1 videocutted.h264
    almost anything that isn't included in ffmpeg libx264 directly can usually be specified through -x264opts . You can include no-dct-decimate too instead of using both -x264opts and -x264-params . Separate switches are separated by a colon

    default values for deadzone-inter and deadzone-intra are 21 and 11 respectively . Lower values will preserve more fine detail, but result in larger filesizes. Like everything , it's a tradeoff. If you look at the tune grain preset it's set to 6 and 6 .
    Code:
    -x264opts no-deblock:deadzone-inter=6:deadzone-intra=6:no-dct-decimate
    preset placebo already specifies 16 reference frames, 16 bframes, so those are redundant commands in your command line .
    Why, after encoding with x264, do I lose last frame? There were 61 frames, became 60 frames.

    Another problem: why, when I try to set qp 16.5, size does not change? It only changes when I specify integers (16, 17), but 16 has a too large size, and 17 has a low quality. I need to select middle, but it does not read 16.5, and rounds off.

    ffmpeg -i videocutted.mpg -aspect 640:480 -c:v libx264 -preset placebo -qp 16 -refs 16 -me_range 64 -bf 16 -trellis 0 -subq 10 -qcomp 0 -aq-mode 0 -x264opts no-deblock=1:deadzone-intra=0:deadzone-inter=0:no-dct-decimate=1:no-fast-pskip=1 videocutted.h264
    Last edited by Megafox; 23rd Sep 2018 at 06:07.
    Quote Quote  
  10. Originally Posted by poisondeathray View Post
    Originally Posted by pandy View Post
    I have strong impression that parameters within x264opts must be passed in strict form like
    Code:
    -x264opts="no-deblock=1"
    -x264opts does not require it for boolean parameters. If you would have checked , you would see that both no-deblock and no-dct-decimate are passed in the example above . It behaves more like x264cli syntax (that's why I prefer it when using ffmpeg libx264) . x264-params behaves more like ffmpeg syntax (key=value) .
    Well this may explain why i saw different behaviour long time ago and begin to use both (i.e. x264-params and x264opts) within single ffmpeg call.

    Code:
    @SET x264opts="qp=%qpval%:qpmin=4:level=4.1:ref=0:bframes=0:no-chroma-me=1:subme=2:open_gop=0:keyint=2:sliced_threads=1:slices=-1:pic_struct=1:aud=1:force_cfr=1:cabac=0:threads=auto:no_psnr=1:no_ssim=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:stitchable=1:constrained_intra=0:no-psy=1:scenecut=0:no-deblock=1:aq-mode=0:ipratio=1.1"
    
    @ffmpeg.exe -y -hide_banner -v 32 -benchmark -i "%1" -c:a copy -bsf:a? aac_adtstoasc -c:v libx264 -preset:v ultrafast -tune:v fastdecode -profile:v high444 -x264opts %x264opts% -x264-params %x264opts% -f mpegts "%~n1_264.ts"
    Quote Quote  
  11. Originally Posted by Megafox View Post
    Why, after encoding with x264, do I lose last frame? There were 61 frames, became 60 frames.
    Probably has nothing to do with encoding. You can double check if it was a libx264 issue with something like utvideo (-c:v utvideo)

    It's probably of the way your source was cut (maybe open gop) and a difference in the way ffmpeg's mpeg2 decoder handles that (different decoders can do it slightly differently)


    Another problem: why, when I try to set qp 16.5, size does not change? It only changes when I specify integers (16, 17), but 16 has a too large size, and 17 has a low quality. I need to select middle, but it does not read 16.5, and rounds off.
    If you look at the x264 fullhelp , qp rate control only accepts integer values
    Quote Quote