Log in

View Full Version : x264 encoding looks horrible!


nicco
5th September 2007, 23:58
I just fibished my 1st x264 encoding and i am so frustrated!!

I used Megui and sharktooth's HQ-Slower profile with a bitrate of 1000 Kbps.
My source is an avi DV movie frameserved from premiere and treated with this script:
LoadCplugin("C:\Programmi\AviSynth 2.5\plugins\yadif\Yadif.dll")
DirectShowSource("d:\...\film1.avi",fps=25,audio=false)
ConvertToYV12()
yadif(mode=0,order=0)
convolution3d(preset="movieLQ")
LanczosResize(640,512)


Final filesize is aprx 750 Mb but it looks SO BLOCKY!! Especially in dark/monochrome areas (like blue sky)!!

WHAT'S WRONG?!?!?

this is jus a very small clip from my video
http://www.megaupload.com/?d=R6EPAJLQ

Dark Shikari
6th September 2007, 00:03
Blockiness in dark areas/sky/etc is usually caused by a lack of Adaptive Quantization. Try turning it on, maybe to 0.5 strength.

Atak_Snajpera
6th September 2007, 12:13
add --aq-strength 0.5 --aq-sensitivity 5 to your command line

chipzoller
7th September 2007, 04:23
Would these two commands be safe to add to Sharktooth's HQ-Slower profile for use in a general encode sense, or are these too specific for general use?

Dark Shikari
7th September 2007, 04:46
Would these two commands be safe to add to Sharktooth's HQ-Slower profile for use in a general encode sense, or are these too specific for general use?
If they're added, they should be added to basically all profiles in a specific category so as not to confuse users.

Another thing I notice is that at very low bitrates, AQ actually makes visual quality worse because at the low bitrates, normally, there are so few bits allocated to dark areas that the blocks don't even change between frames. However, with AQ, the blocks flicker back and forth from the extra bits, since not enough bits have been allocated to actually get rid of the blocking.

chipzoller
7th September 2007, 05:00
they should be added to basically all profiles in a specific category so as not to confuse users.
I was asking more for MY personal use in one or two of the upper profiles and not suggesting they be used in "stock" profiles for mass distribution.

Another question: What constitutes low bitrate if frame-size hovers in the 640 range? 700-800? 800-900? I try to shoot my encodes (~2hrs or a bit more max.) so they can fit (if need be to back them up on another medium besides my RAID array) onto a CD, so around 700-710MB and notice that my bitrates, when aiming for this limit, often are in the 750-1000 range with a frame-size of 640xX. Knowing my usage habits, are those two commands advisable for general profile inclusion?

Dark Shikari
7th September 2007, 06:10
I was asking more for MY personal use in one or two of the upper profiles and not suggesting they be used in "stock" profiles for mass distribution.

Another question: What constitutes low bitrate if frame-size hovers in the 640 range? 700-800? 800-900? I try to shoot my encodes (~2hrs or a bit more max.) so they can fit (if need be to back them up on another medium besides my RAID array) onto a CD, so around 700-710MB and notice that my bitrates, when aiming for this limit, often are in the 750-1000 range with a frame-size of 640xX. Knowing my usage habits, are those two commands advisable for general profile inclusion?
That should be fine if you have decent denoising. If your sources have tons of grain/noise, that's definitely "low bitrate". With denoising its plenty of bitrate IMO.

nicco
7th September 2007, 09:34
My final settings

1h40min original DV PAL movie source, very noisy, light scenes as well as dark ones.

Pre-processing:
LoadCplugin("C:\Programmi\AviSynth 2.5\plugins\yadif\Yadif.dll")
DirectShowSource("...DV.avi",fps=25,audio=false)
ConvertToYV12()
yadif(mode=0,order=0)
FFT3DFilter(sigma=2.6, bt=4, bw=32, bh=32, sharpen=0.4, degrid=1)
LanczosResize(640,512)


FFT3DFilter is much better than Convolution3D for my taste, it removes a lot of noise without hard smoothing

encoding with x264
Bitrate 2300 Kbps (this is a relatively "high" bitrate but DV sources are usually bad sources with a lower compressibility)
i used custom matrix "M4G HRM V2.cfg" http://forum.doom9.org/showthread.php?t=117041&highlight=x264+custom+matrix&page=4
CLI: --pass 2 --bitrate 2300 --stats ".stats" --ref 3 --mixed-refs --no-fast-pskip --bframes 3 --b-pyramid --bime --weightb --direct none --filter -2,-4 --subme 6 --analyse all --8x8dct --merange 20 --threads 2 --thread-input --deadzone-inter 4 --deadzone-intra 6 --aq-strength 0.5 --aq-sensitivity 5
-no trellis
-the italic codes were manually added referring on custom matrix thread an this thread

Final output movie is 1.6 Gb (what i was looking for) and it looks very very good.

@chipzoller
in my experience 800-900 Kbps are quite low for a 2h noisy movie, expecially a self-made movie (DV-camcoder), it is difficult to fit it into 1CD with a reasonable good quality (look @ my 1st post:p).
But it's relative to your "quality" target and your source. Anyway I recomend you to de-noise movies with a good filter before encoding, it is really very important.

nicco

Sagekilla
7th September 2007, 20:58
Why is --merange set to 20? There's really no huge benefit from increasing --merange from it's standard setting. I've used both --merange 16 all the way up to 32 and there was VERY tiny differences in quality throughout.

Unless you actually do see improvements from increasing --merange by 4, it should be left at stock (remove it all together)

Dark Shikari
7th September 2007, 21:02
Why is --merange set to 20? There's really no huge benefit from increasing --merange from it's standard setting. I've used both --merange 16 all the way up to 32 and there was VERY tiny differences in quality throughout.

Unless you actually do see improvements from increasing --merange by 4, it should be left at stock (remove it all together)--merange helps a decent bit at high resolutions. Note however that its completely useless with --me hex, and only helps with --me umh or esa.

Sagekilla
7th September 2007, 21:05
It does, but he's using sub-DVD resolutions of 640x512.. not quite high resolution if you ask me, unless that's high enough for it to actually make a difference.

Terranigma
7th September 2007, 21:57
It does, but he's using sub-DVD resolutions of 640x512.. not quite high resolution if you ask me, unless that's high enough for it to actually make a difference.

It's worth it imo. merange 16 can tend to be a bit blocky sometimes, whereas a merange of 24 is blockless. Well from my experiences anyways.

Sagekilla
7th September 2007, 22:54
It's worth it imo. merange 16 can tend to be a bit blocky sometimes, whereas a merange of 24 is blockless. Well from my experiences anyways.

Guess it can vary quite a bit. I use crf so increasing merange, if it works well as you say, would only result in smaller file size.

nicco
8th September 2007, 10:23
Well, i am not so familiar with x264, i used *mp4.guy custom matrice and i followed his suggestions:

I would recommend using these options:
-no fast p-skip
-no dct decimation
-no b-rdo
-aq (with whatever settings you like)
-5 reference frames
-mixed reference frames
-max 3 b frames
-multi hex motion estimation with search range 24 (default is 16)
-rdo6
-keyeframe interval 240 (250 for pal)
-min gop size 48 (50 for pal)
-chroma me
-all macroblock options enabled
-all b-frame options enaabled (except b-rdo)
- deblock -1:-2, or -2:-4 (second is sharper, but maybe more ringing)


But this movie is giving me crazy, in fact when i mux the avc-.mp4 encoded movie with the aac audio (but same with mp3) the audio become progressively more and more out-of-sync during playback!!!
I tried muxing with Megui, MKVtoolkit, but nothing to do, audio become out-of-sync!!
Video and audio streams have the same duration, i think the problem is in the x264-encoded video stream (original a/v are perfectly on sync), maybe some "wrong" settings in x264 encoding:confused::confused:

i've red around in forum some other similar problem but i can't find a solution.....

check
8th September 2007, 10:51
is your CPU maxed out at 100% during playback? If so, the problem is simply your computer is too slow to decode the video in real time. Try CoreAVC or a faster CPU.

nicco
8th September 2007, 11:03
is your CPU maxed out at 100% during playback? If so, the problem is simply your computer is too slow to decode the video in real time. Try CoreAVC or a faster CPU.

3.6 GHz Pentium CPU with 2 Gb RAM? I don't think it is too slow :rolleyes:

foxyshadis
8th September 2007, 12:59
If it's 720p or 1080p, and you're using an ffmpeg-based decoder, then yes, it's likely to be too slow even at that speed. Actually, on a single core even Nero and Cyberlink software-decoding won't really gain you anything. If it's the same as the original post, with 1000kbps DV encode, that's not the case.

As check said, check your cpu% with task manager. If it's too high, turn the bitrate down or buy coreavc. If it's not too high, it's a framerate issue, you need to remux specifying the proper framerate. (Might be DirectShowSource's fault.)

nicco
8th September 2007, 13:41
If it's the same as the original post, with 1000kbps DV encode, that's not the case.

My CPU is Dual-Core 3.4 Ghz, no problem in playback uncompressed DV movie with avisynth deinterlacing filter on (MPC and ffdshow avisynth plugin).....could it have with avc?
Btw the movie with the problem is the 2300Kbps MP4-AVC x264

If it's not too high, it's a framerate issue, you need to remux specifying the proper framerate. (Might be DirectShowSource's fault.)

i'm just encoding the movie using "AVISource", i'll let you know

Sharktooth
8th September 2007, 14:11
FPS and resolution?

nicco
8th September 2007, 15:41
original movie: 720x576 PAL DV @ 25 fps

x264 encoded movie: 640x512 @ 25 fps

nicco
10th September 2007, 09:03
I post this reply just for ppl who will have same out-of-sync problem

I solved using "AVISource" instead of "DirecShowSource" in my input avs script:

LoadCplugin("C:\Programmi\AviSynth 2.5\plugins\yadif\Yadif.dll")
AVISource("...DV.avi",audio=false)
ConvertToYV12()
yadif(mode=0,order=0)
FFT3DFilter(sigma=2.6, bt=4, bw=32, bh=32, sharpen=0.4, degrid=1)
LanczosResize(640,512)

now audio and video are perfectly sinchronyzed in final MP4-x264 encoded file (muxed with megui) :p:p

Sharktooth
10th September 2007, 14:07
damn, im really sorry. i didnt think at the DSS desynch since we recently fixed megui to automatically add AviSource() for avi files, so my attention was focused on other possible causes...

nicco
10th September 2007, 16:15
d i didnt think at the DSS desynch since we recently fixed megui to automatically add AviSource() for avi files,

Well...my 1st script was automatically created by AVS script creator with "directshowsource" , i added some more filters (yadif, denoise) in a second time..

And it still creates "directshowsource" AVS scripts:
DirectShowSource("...DV.avi",fps=25,audio=false)
#deinterlace
#crop
# Lanczos (Sharp)
#denoise


this is the original script from MeGUI when i add my DV-source in AVS Script Creator

Sharktooth
10th September 2007, 16:31
you're not using the development version (0.2.6.x)

nicco
10th September 2007, 16:35
you're not using the development version (0.2.6.x)


0.2.5.1007:p

hope new fixed version will be available soon

Sharktooth
10th September 2007, 16:43
you can try the development version by switching from stable to development auto-update server.
Options>Settings>Extra Config>Configure servers...>switch from stable to development.

nicco
10th September 2007, 16:46
Thank you! :)

version 0.2.6.1009:

AviSource("...DV.avi")
#deinterlace
#crop
# Lanczos (Sharp)
#denoise

Sharktooth
10th September 2007, 16:50
it should be 0.2.6.1010...