levels problem when frameserving RGB to MeGUI

john-beale wrote on 7/28/2010, 12:43 PM
My source video is 1080p60 from the Panasonic TM700. Vegas works fine with this material. I want to generate high-quality 1080i MP4 files for PS3 playback. The internal Sony MP4 option seems limited to 16 Mbps which is not acceptable. So I'm using the Debugmode framserver (in RGB output mode), going to MeGUI and the x264 encoder. This works, but I am having video levels problems. I think there are only two possible options, and one of them should be correct (PC levels, or Video levels). However BOTH are wrong!

My avisynth script is:
---
AviSource("C:\fs.avi")
ConvertToYV12(matrix="PC.709")
---
this results in increased contrast. However if I use instead

ConvertToYV12(matrix="Rec709")

then I get DECREASED contrast! I confirm the contrast problem by loading in the final .mp4 into Vegas and toggling between the original file, the the rendered mp4. In both cases, my output levels have been altered. Is anyone using MeGUI from Vegas? How do you maintain correct levels?

Comments

musicvid10 wrote on 7/28/2010, 1:02 PM
Nick Hope has had some experience with this.
Send him an email through the forum and see if he can shed some light on it.

What happens if you just leave it at default?

ConvertToYV12()
john-beale wrote on 7/28/2010, 1:08 PM
ConvertToYV12()

results in everything becoming slightly brighter (histogram moves up, as a block). It has the effect of lowering contrast, since there are no more true black areas.
musicvid10 wrote on 7/28/2010, 1:13 PM
I'm not very knowledgeable, but it seems an overall shift would be easier to pre-correct than a colorspace shift.

Both Nick Hope and johnmeyer have far more knowledge than me.

As a note, the Sony AVC encoder will go up to 20Mbs and the MainConcept encoder will go to 240Mbs.
john-beale wrote on 7/28/2010, 1:24 PM
Thanks for the reply; I've sent the email to Nick Hope. Yes, I can do pre-correction but that will give me some posterization, given that each step in the process is quantized to 8 bits. I was hoping there was some simple way to just do it right, and avoid needing to pre-correct.

EDIT: I see that if I set Sony AVC/MP4 to MP4 output, it allows 20 Mbps. However when I actually try to render to it, I just get "Error opening codec". I am using Vegas 9e.
musicvid10 wrote on 7/28/2010, 1:32 PM
I'm having my own set of issues trying to take 7D footage to Handbrake (the dummy's avisynth) via an intermediate.

Most of them don't work (Cineform, Lagarith, etc.) and the ones that do (DNxHD, HuffYUV) do an unwanted ITU-R 601/709 conversion. Unfortunately, Handbrake's CLI does not have a way to force 0-255.

EDIT: The MainConcept AVC encoder isn't available in Vegas Pro 9?
john-beale wrote on 7/28/2010, 1:46 PM
EDIT: I tried reinstalling Vegas 9e and hey, now MainConcept AVC is there! Apparently something happened to it before; don't know what.

By the way I see Vegas uses "QT7PLUG.DLL" to read files of type MP4. I wonder if Quicktime is doing its own unwanted levels shift on import- probably it is.

File Properties/General:
Plug-In
Name: qt7plug.dll
Folder: C:\Program Files\Sony\Vegas Pro 9.0\FileIO Plug-Ins\qt7plug
john-beale wrote on 7/28/2010, 3:13 PM
Well, that is interesting. MainConcept AVC generates a .mp4 file that has ALMOST (but not quite!) the same levels as the original. However for some reason, it also decided to give me half the frame rate. My project is 29.97 fps interlaced, and encode format is 29.97 fps nterlaced, and what did I get? This:

Video: 00:02:32.486, 14.985 fps interlaced, 1920x1080x12, AVC

EDIT: and if I change the timeline to the native format (1080p 59.94 fps) and try to encode 29.97 interlaced, Vegas just crashes ("system low on memory", although it isn't). Has anyone sucessfully encoded TM700 footage (1080p60) to 1080i and lived to tell the tale?

EDIT: got it working, by unchecking the box "allow source to set frame rate". Finally.
musicvid10 wrote on 7/28/2010, 3:49 PM
As we've tossed about in a couple of other threads, rendering 54.94p to 29.97p (with Resample Disabled) produces some excellent results, well suited for internet delivery.

If you're going to use the encoders in Vegas though, run them through MP4 Fast Start to set them for streaming.
NickHope wrote on 7/28/2010, 4:11 PM
The Avisynth script that you started with is what I would also have used. To be honest I was so happy when I discovered (matrix="PC.709") that I never scrutinised the contrast of my output against the original (HDV in my case). I was just chuffed that I no longer had to tolerate the wishy washy brighter image.

Is QT7PLUG.DLL being used by Vegas to read both your original MP4 footage and the rendered MP4 file? In that case wouldn't it apply any level shift equally to both of them? Alternatively, if you're comparing to an intermediate .avi file on the Vegas timeline then I'm not surprised that there is a difference.

How about visually comparing the camera's original MP4 footage against your rendered MP4 file on the PS3 itself?

Musicvid flatters me regarding my Avisynth knowledge, and I'm afraid I can't really help any further. You could ask your question on the Avisynth forum at http://www.doom9.org/ and possibly get an answer there.
john-beale wrote on 7/28/2010, 4:14 PM
Thanks for the 29.97p and fast-start tips, quite helpful.

I see that "disable resample" seems to be a clip property, instead of a global setting. Is there any easy way to disable resample on an entire project at once?
musicvid10 wrote on 7/28/2010, 4:17 PM
Musicvid flatters me regarding my Avisynth knowledge,
I really don't know enough to be dangerous -- as you know I'm a Handbraker (= Slacker).

You could ask your question on the Avisynth forum at
Or you could come back a bloody stump. Be forewarned.
musicvid10 wrote on 7/28/2010, 4:20 PM
Is there any easy way to disable resample on an entire project at once?

Sure is.
Select the first clip and click Switches->Disable Resample.
Copy the first clip (Ctrl+C).
Then select all the clips (Ctrl+A) and "Paste Event Attributes."
You're done.
john-beale wrote on 7/28/2010, 6:11 PM
Ah yes, thanks again. (Just need to remember to undo any other customizations on the first clip, before copying to all rest.)

By the way, I tried making a 1920x1080p29.97 mp4 clip and it plays fine and looks great on my PC, but the PS3 just shows a black screen (although it does have the audio). Is 1080p30 not a format the PS3 can do?