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
[Attachment 46754 - Click to enlarge]
+ Reply to Thread
Results 1 to 11 of 11
-
Last edited by Megafox; 21st Sep 2018 at 12:50.
-
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
[Attachment 46755 - Click to enlarge] -
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 -
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
-
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) .
-
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.h264Last edited by Megafox; 23rd Sep 2018 at 05:07.
-
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"
-
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.
Similar Threads
-
FFMPEG x264 parameters
By marcorocchini in forum Newbie / General discussionsReplies: 6Last Post: 4th Aug 2018, 11:21 -
Streaming x264 1080i using ffmpeg?
By nalwolf in forum Video Streaming DownloadingReplies: 0Last Post: 24th Jun 2018, 15:25 -
ffmpeg/x264 RGB to YUV
By SameSelf in forum Video ConversionReplies: 40Last Post: 14th Nov 2016, 18:40 -
x264 - how to reduce deblocking?
By ben45 in forum Video ConversionReplies: 3Last Post: 23rd Aug 2016, 02:01 -
ffmpeg vs x264 cli
By SameSelf in forum Video ConversionReplies: 11Last Post: 6th Jun 2015, 22:02