All of the players I use (MPC-HC, VLC, and WMP) tend to render MeGUI 10-bit x264 encodes darker than the FRAPS avi originals. By setting the Output Range in MPC-HC to "16-235" I was able to get what seemed like a match. I did notice that the MeGUI encodes, even with very high bit rates, tended to look lighter than the originals in darker scenes. I assumed this was something that happened in the encoding process.
However, I recently decided to try a lossless x264 encode, and I noticed this same lightness in dark scenes when viewing with MPC-HC. So obviously, if lossless x264 is truly lossless, the issue is with the decoding, not the encoding.
What program or method can I use to visually compare my FRAPS and MeGui encodes without introducing this brightness issue? I would also like to use this program to take corresponding frame grabs from both videos, something I use the MPC-HC "Save Thumbnails" function for now.
Any help will be greatly appreciated.
+ Reply to Thread
Results 1 to 11 of 11
Adjust your graphics card's video proc amp to get YUV video displaying the same as desktop RGB. YUV video is always converted to RGB for display. Most media players let the graphics card do that. The graphics card driver's default video proc amp settings are often wrong.
Or you can use an AviSynth script to convert YUV to RGB, controlling exactly how it's done. I like to use a script like:
v1=AviSource("RGB.AVI") # assuming RGB here v2=ffMpegSource("h.264.mp4").ConvertToRGB(matrix="rec709") Interleave(v1,v2)
Last edited by jagabo; 1st Jun 2014 at 08:05.
Thanks for the response.
My FRAPS captures are actually YUV.
I tried the script you posted, but I'm getting the error:
script error: there is no function named "ffMpegSource"
Do you have any suggestions?
Okay, I've gotten it to work partially. I switched to 32-bit VirtualDUB and I used "ffVideoSource" instead of "ffMpegSource"
VirtualDUB now opens the script, but the lossless x264 image quality is nothing near what it should be.
The result is the same whether I use Rec.709 or Rec.601.
You could try:
-Edit- or it could be the FRAPS decoder.
Sorry, I wrote that script off the top of my head. I should have written ffmpegsource2() not ffmpegsource(). Or you can use ffvideosource(), like you eventually tried.
Some issues you might run into using the ffmpeg source filter in AviSynth: Encoding sometimes results in a frame delay so you often have to align the two videos with a Trim(). Random seeking often delivers corrupt frames until you step forward to the next key frame. It's also not always frame accurate -- for example, randomly seeking to frame 1000 might sometimes return frame 999, or 1001, or some other frame.
If you use Subtract() (pixel by pixel subtract) you're left with a medium grey image when the two images match. Any variation indicates a difference. You can apply a contrast stretch after Subtract() to make the difference more visible. Here's an example where two videos were compared with Subtract, showing the two videos, the result of subtract, and the contrast enhanced subtract:
Thanks ndjamena and jagabo! I tried the Subtract method. The difference shown is what should be expected, given the quality of the screenshot I posted.
jagabo, in your second paragraph, are you implying that one can avoid random seeking either by using trim, or by some other method? If so, how would I go about doing that?
Also I've considered just re-encoding both videos with lossless codecs inside an AVI container. Is this something that could work, or would it just introduce more opportunity for filters to skew things?
Last edited by Pilotwings_64; 4th Jun 2014 at 00:49.
You can improve ffvideosource random seeking using seekmode=0. It will be slower, but more accurate
You mentioned "YUV" for FRAPS, so you're using the using "regular" recording, not the lossless RGB FRAPS ?
The decoder chosen will affect how it's being decoded. The FRAPS decoder e.g using AVISource() will convert to RGB, using standard range. Libav , FFMS2, will decode it as full range YUV, so the levels will look different unless you use a PC matrix somewhere in the chain for converting to RGB for display
lossless x264 is truly lossless at the same bit depth and colorspace. Thus it's not lossless for you because you're using 10bit, and you're probably not encoding full range correctly, or decoding full range correctly . Most media players will not be set up to handle full range YUV, or obey full range flags
I have a very vague understanding of what you're saying. I don't really have a clear idea of the entire encoding/decoding process, so it's hard to make sense out of it.
I understand that lossless video will produce the exact same bitstream when decoded as the original when its decoded. So obviously some decoding has to take place before the lossless video can be encoded. However, this would seem to undermine the point of lossless video, or at least make an expert knowledge of video encoding necessary in order to produce a lossless video. Beyond that, I don't understand much about the basic pieces of the chain that takes the original source to a file and then from that file to my screen. I know some, but not nearly enough.
Can you recommend any tools I can use to accomplish all of the things you mentioned in your post?
Also, can you comment on my idea to encode both the FRAPS and the x264 videos into lossless AVIs using the same codec, so I don't have these decoding issues?
Last edited by Pilotwings_64; 4th Jun 2014 at 06:06.
NamedVid = ffVideoSource("filename.ext", seekmode=0)
You can explicitly convert colorspaces with ConvertToYV12(), ConvertToYUY2(), ConvertToRGB32(), etc. Within those filters you can specify what colormatrix to use, for example ConvertToYV12(matrix="rec709"). But those are mostly lossy conversions. So you can't perfectly compare an RGB video to a YV12 video. The best you could do is convert one of them to the colorspace of the other and then compare. Say you have an RGB source and you want to convert to lossless x264. You could first explicitly convert your source to YV12 and compress that:
v1=AviSource("RGB.AVI").ConvertToYV12() v2=ffVideoSource("x264.mp4", seekmode=0) Subtract(v1,v2)
Also keep in mind that everything that shows up on the monitor is converted to RGB one way or another. Explicitly by the software or implicitly by the graphics card.
If your fraps yuv sources are YV12 and you use 8 bit x264 (which work in YV12 by default) you can compare the two directly. I don't know enough about how 10 bit x264 upsamples 8 bit sources to 10 bit to say exactly how you can compare them.