View Full Version : x264: encoded file has gray haze?
Comatose
30th December 2007, 15:46
Hi!
I'm having a really strange problem... encoding to h264 (using x264) causes white or gray haze to cover the entire video.
I encoded a small video from Avisynth to Lagarith Lossless and then from the lagarith file (which looked fine (http://img242.imageshack.us/img242/411/lags1vi6.png)) to h264 lossless, which has the haze (http://img341.imageshack.us/img341/3978/att2zm4.png).
Please don't mind the fact it's not the same frame - the FPS wasn't the same, but it doesn't matter, this happens to the entire video.
At first I thought it might be a decoder or something, because when loading a h264 encoded video with directshowsource() in Avisynth, the haze is gone (which implies that it might not be part of the video), so I tried CoreAVC.
It happens with both CoreAVC and ffdshow, so I don't know what to try next.
I really don't want my encodes to look like this to the viewers, so I'd be very thankful for any help :)
Thanks!
Dark Shikari
30th December 2007, 15:50
Its not a gray haze, its just a lack of luma range. When playing back your original file, you're probably doing a TV -> PC conversion, and this isn't being done for playing back the resulting file.
Comatose
30th December 2007, 15:51
Is there anything I can do to permanently "fix" it for other people? d:
Dark Shikari
30th December 2007, 15:57
Is there anything I can do to permanently "fix" it for other people? d:You could do the conversion to PC range in the Avisynth script.
Comatose
30th December 2007, 16:00
Now that you mention it... I'm not sure if that lags encode is from before or after I added Levels() :\
Time to try.
Comatose
30th December 2007, 16:45
Levels(16, 1, 235, 0, 255, coring=false)
Same thing. Lagarith (http://img185.imageshack.us/img185/5307/lags2ig8.png) | h264 (http://img183.imageshack.us/img183/2990/att3pd0.png)
Avisynth (avsp preview) output is identical to Lagarith.
Dark Shikari
30th December 2007, 16:48
Are you playing the output video while you have the input video still open? Your graphics card will only accelerate one overlay at a time, so only the first will get the TV -> PC conversion.
Comatose
30th December 2007, 17:30
Nope. Also, this doesn't happen even if I play the lags encode twice.
Anyway, I encoded a 25 frame video in h264 lossless with the purpose of showing it to you and asking you to screenshot it, but it didn't happen this time.
Could it be because my Levels() line isn't at the end of the script? Should it be? Even if that's the case, why is it that it doesn't happen to Lags?
I used this script:
Blackness(length=25,width=704,height=480,pixel_type="YV12",fps=25)
mkv=directshowsource("op_test.mkv").FreezeFrame(0,24,525).Trim(0,24)
lp("RemapFrames")
ReplaceFramesSimple(mkv, mappings="[0 24]")
Levels(16, 1, 235, 0, 255, coring=false)
Comatose
30th December 2007, 18:08
It seems that it was just because of lines like:
ReplaceFramesSimple(Tweak(sat=1.00, cont=0.93, bright=-5), mappings="[95 306] [625 705] [1459 1580]")
In the encode that goes to Lagarith. Applying Levels() after that made it look more like the Lagarith encode, but there's still a small difference.
Either way, I want h264 lossless to look very close to Lagarith without having to do something like that. Doing it like that isn't reliable at all.
edit: Or not. It's actually identical. I'm going insane T_T!
Comatose
30th December 2007, 19:30
I may have fixed it. Maybe.
edit: Yay! Yes! I had to use Levels() in both the file that reads from the raw (with all the filters) - this file encodes to Lagarith AND the file that reads from Lagarith and encodes to h264.
foxyshadis
30th December 2007, 23:54
Signal the colorometry when you encode! This is vital, or else it will be decoded wrong by conforming decoders that assume TV range. A fair number of people are going to be using broken decoders anyway, so there is nothing you can do to fix your file for everyone.
The only way to fix this with 100% compatibility is to decode to RGB in the decoder, with TV levels (not the PC levels you're forcing it to). All other combinations of colorspaces and levels will be decoded wrong by some percentage of graphics drivers.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.