adding BT709 flag in render?

jason-duncan schrieb am 16.12.2018 um 15:51 Uhr

Hello,

I'm working with NTSC MiniDV footage and recently have been using AVISynth/QTGMC to deinterlace, which means my new frame rate is 59.94. Delivery is BD-25 so I'm also upscaling to 720p during the deinterlace process. Since the output is going to be a BD, I've read to add the bt709 flag so there's more of a chance the player can read the correct color space. Is this basically the same process in Customize Template-Project-Color Space-dropdown to Rec.709?

The command I've seen for this is: "--ColorMatrix bt709"

Kommentare

Musicvid schrieb am 16.12.2018 um 17:29 Uhr

Your DV is REC 601, and is better left alone. Your Vegas encoder will make the proper transfer characteristic choices for you, not by second-guessing a flag. Vegas is very good about this.

That said, it makes absolutely no difference that you or I will ever see. For example, all early Canon DSLR HD footage was flagged REC 601, and this went on for a number of years.

Avisynth command lines do not work directly in Vegas, nor do you need to go there. The new Happy Otter extension have Avisynth and QTGMC built in if you prefer that route, but changing to B.T.709 is not all that necessary there, either.

 

john_dennis schrieb am 16.12.2018 um 17:52 Uhr

"Delivery is BD-25 so I'm also upscaling to 720p during the deinterlace process."

You don't have to, probably shouldn't, upscale to put your SD program material on Blu-ray disc.

The Blu-ray standard allows you to include SD material.

  

Find some other way to spend your time.

jason-duncan schrieb am 16.12.2018 um 17:57 Uhr

Thanks Musicvid. I was just wondering if manually selecting Rec.709 was recommended, since the footage is now upscaled to 720p. I realize MiniDV upscaled to 720p doesn't make it true HD. Since dvd doesn't support 59.94, I figured I'd output to BD. I'm sort-of at the mercy of the new frame rate and what media accepts it and since it's now Progressive I don't want to go back to Interlaced just for dvd.

I would have never guessed any HD camcorder would flag as rec.601. I'd be bummed. Being how I only have DV, I know I'm stuck at 601.

I just found out about the Happy Otter extension today, so I'll check into that.

john_dennis: I was typing up my new post while you sent your post.

Thanks for that chart. Remember this footage is now deinterlaced, so the frame rate is 59.94P, not I. Does Progressive SD 59.94 work with the BD standard?

 

john_dennis schrieb am 16.12.2018 um 17:58 Uhr

Note to self and moderators. Italicized text appears to break the forum hyperlink text display.

Musicvid schrieb am 16.12.2018 um 18:28 Uhr

I was just wondering if manually selecting Rec.709 was recommended, since the footage is now upscaled to 720p.

No, Vegas encoders do this all for you automatically-- transfer points, primaries, matrix, the whole nine yards. And with your material it doen't make a bit of difference.

NickHope schrieb am 19.12.2018 um 16:42 Uhr

If you're deinterlacing with QTGMC then I assume you have a line like this in your script:

ConvertToYV12(interlaced=true)

The AviSynth Convert filter supports a colour matrix conversion parameter. By default it is Rec601 (and is not stated at all). Instead of using an extra --ColorMatrix bt709 line I think it's better just to do any necessary conversion using that parameter.

If I am converting frameserved PAL DV RGB to an RGB AVI intermediate file in VirtualDub, via QTGMC in AviSynth, then Rec601 is correct, and I use the line above (i.e. with the implied matrix="Rec601"), even if I am upscaling to 720p.

However if I am doing the same thing but encoding an x264 file in MeGUI, then I need to use matrix="PC.709" instead:

ConvertToYV12(interlaced=true, matrix="PC.709")

So it's quite difficult to predict exactly what matrix is required when you are pushing video through a complex chain of filters like this. It's certainly not the case that 709 should be always used just because you've upscaled to HD. But in some cases it should.

My recommendation is to take a Belle Nuit test chart right through your process from timeline to TV and see how the final result compares to the original. Try it with all 4 matrix options. One obvious way to see if you've got the "601 vs 709" thing wrong is to look for a change in "relative brightness" between the green and magenta bars in particular. That is quite obvious when it's wrong. You can also check that you've got the "Rec vs PC" thing right by looking at the very dark (0-20) and very bright (231-255) parts of the chart, but bear in mind that anything 235-255 should be white in the final result (on your TV or player, not the Vegas preview window), and anything 0-16 should be black.

Having said all of that, I wouldn't deinterlace or upscale DV at all for DVD or Blu-ray playback. (I do however enjoy deinterlacing and upscaling 576i PAL DV to 720p for faux-HD for the web).

jason-duncan schrieb am 20.12.2018 um 01:12 Uhr


 

Nick,

Yes, I do have ConvertToYV12(interlaced=true)
in my script (see full script below- and I just added your code of matrix="PC.709" as a test). I
recently discovered AVISynth so I'm on a proper deinterlace kick. I realize
I'm ten years behind. I know upscaling SD to HD usually isn't
recommended, but QTGMC does such an awesome job at converting interlace to
progressive, and with the new frame rate being 59.94 I figured 1280x720 would
be the way to go, since SD doesn't support 59.94p.  

I learned after I posted tis thread that
"--ColorMatrix bt709" should not be in the script.  

I am confused why you say you wouldn't deinterlace for DV? I
could understand not upscaling. QTGMC does a better job at deinterlacing than
any set-top dvd/BD player.

One weird thing I've noticed about the QTGMC file is when I
import that new file in the Vegas Timeline and compare it to the raw file, the
overall image is darker. Yet when I view both files in Windows Media, they appear
to be the same brightness.

Thank you for the Belle Nuit test chart. I'll have to study up
on that.

Maybe with this new Happy Otter we won't need AVISynth.

v = LWLibavVideoSource("input.avi", format="YUY2")
a = LWLibavAudioSource("input.avi")
AudioDub(v,a)
Colormatrix(mode="rec.601->rec.709")
AssumeBFF()
ConvertToYV12(interlaced=true, matrix="PC.709")
QTGMC()
nnedi3_rpow2(2,cshift="Spline36Resize",fwidth=1280, fheight=720)


 

Musicvid schrieb am 20.12.2018 um 01:33 Uhr

Your upscaling and interlace on Blu-ray will be better at native SD interlaced.

Hardware uprez to HD and deinterlace are still considered superior.

Again, people tend to get worked up over the "wrong" matrix. It's a tempest in a teacup.

Actual difference between 601 and 709 primaries cannot be detected with the eyes. There is a very subtle shift in the green primaries whose origin is mostly political. Time would be better spent grading than fussing.

Ehemaliger User schrieb am 20.12.2018 um 02:52 Uhr

"Delivery is BD-25 so I'm also upscaling to 720p during the deinterlace process."

You don't have to, probably shouldn't, upscale to put your SD program material on Blu-ray disc.

The Blu-ray standard allows you to include SD material.

  

Find some other way to spend your time.

@jason-duncan

@john_dennis and @Musicvid are completely correct. I'd take their advice if I were you!

Musicvid schrieb am 20.12.2018 um 03:11 Uhr

jason-duncan schrieb am 20.12.2018 um 04:13 Uhr

I realize I have three things going on: deinterlacing, upscale, & bt709. Please tell me you guys would at least recommend deinterlacing? If not, why? I have researched exhaustively and everyone says QTGMC is way better than any set-top players deinteralcing. If this is true, 29.97i becomes 59.94p. You wouldn't go from interlaced to progressive, back to interlaced for delivery correct?

Musicvid schrieb am 20.12.2018 um 04:43 Uhr

You are welcome to experiment all you want. If you "bob" your video to 60p in QTGMC it will look fine, but maybe add a little shadow noise. You do not need to change your color matrix.

As far as going beyond the native resolution and interlacing for your BluRay, you are alone, but please post actual samples of both so we can compare and share your impressions wrt software scaling and deinterlace vs. hardware (player). Hippy Holiday!

Ehemaliger User schrieb am 20.12.2018 um 05:33 Uhr

 

Having said all of that, I wouldn't deinterlace or upscale DV at all for DVD or Blu-ray playback. (I do however enjoy deinterlacing and upscaling 576i PAL DV to 720p for faux-HD for the web).

For a site like youtube, for highest quality results you must deinterlace & upscale to 720p50/60 as there is no such format as 576p50 or 480p60

NickHope schrieb am 20.12.2018 um 08:24 Uhr

This is what happens if you get the matrix parameter wrong in the Convert filter in AviSynth. The top half is with matrix="Rec709", the bottom half is with an implied matrix="Rec601". As you can see there is a significant difference between some of the color bands, especially in the green.


While in much real-world footage the difference would be difficult to see, it's worth getting it right for the sake of a few characters of code.

This is the script I used (minus the multi-threading code), rendering to MagicYUV RGB in VirtualDub 2. The first of the 2 "Convert..." lines was the right one in this case.

AviSource("d:\fs.avi")
AssumeBFF()
ConvertToYV12(interlaced=true)
#ConvertToYV12(interlaced=true, matrix="Rec709")
QTGMC(Preset="Slower")
Spline36Resize(960,720)
AssumeFPS(59.94)

That is probably the script I would personally use for this job. I would put the intermediate file back on the Vegas timeline and add some sharpening before final render. I've tried NNEDI3_rpow2, ResampleHQ etc. in the past and found they didn't really give an advantage and just slowed things down.

...I am confused why you say you wouldn't deinterlace for DV? I
could understand not upscaling. QTGMC does a better job at deinterlacing than
any set-top dvd/BD player.

Is that based on what you've read or experience? Common opinion I've read is that good hardware does a better job, but it's been years since I pixel-peeped myself it on a TV. Apart from seeing no advantage in software-deinterlacing, part of my rationale in keeping interlaced for my own DVDs was for older CRT and plasma TVs, which still display interlaced as interlaced. That consideration is obviously becoming less relevant.

One weird thing I've noticed about the QTGMC file is when I
import that new file in the Vegas Timeline and compare it to the raw file, the
overall image is darker. Yet when I view both files in Windows Media, they appear
to be the same brightness.

How are you rendering? What program? What codec? Are you frameserving to it?

Ehemaliger User schrieb am 20.12.2018 um 11:21 Uhr

 

...I am confused why you say you wouldn't deinterlace for DV? I
could understand not upscaling. QTGMC does a better job at deinterlacing than
any set-top dvd/BD player.

Is that based on what you've read or experience? Common opinion I've read is that good hardware does a better job, but it's been years since I pixel-peeped myself it on a TV. Apart from seeing no advantage in software-deinterlacing,

I would accept the video from a certified bluray player direct to tv should be good, but what if that video is ripped to a media player, or played on a computer. Now you have no idea what quality the viewer will see. It's down to the software player & whatever deinterlacing method is chosen. Many media boxes can't do HDMI Pass-Through, so the TV never gets to deinterlace anything.

When my tv sees an interlaced video it frame doubles & produces quality 50p video with each frame unique & showing a progression of movement (smooth). My media box converts 50i to 25p & looks terrible(jerky). You could never know I was going to play your high quality 50i video on my garbage media box but if the video was 50p to begin with there would be no loss in quality

jason-duncan schrieb am 20.12.2018 um 20:28 Uhr

This is what happens if you get the matrix parameter wrong in the Convert filter in AviSynth. The top half is with matrix="Rec709", the bottom half is with an implied matrix="Rec601". As you can see there is a significant difference between some of the color bands, especially in the green.

As far as the Belle Nuit pattern, do I record that back to my MiniDV tape, then transfer to the PC via Firewire, then render one option with rec601 and one with rec709 to compare?

AviSource("d:\fs.avi")
AssumeBFF()
ConvertToYV12(interlaced=true)
#ConvertToYV12(interlaced=true, matrix="Rec709")
QTGMC(Preset="Slower")
Spline36Resize(960,720)
AssumeFPS(59.94)

When you have a # in the code, isn't that just a note to the user? so that means: matrix="REC709" is not in the command?

How are you rendering? What program? What codec? Are you frameserving to it?

I haven't rendered a file yet other than what AVISynth has done. I imported the new QTGMC file back into Vegas just to see how it compared to the raw AVI. I noticed the QTGMC-file looks overall darker than the original file when both are in the same Timeline. Yet, when viewing in a non NLE program, like Windows Media there is no difference in brightness.

 

Musicvid schrieb am 20.12.2018 um 20:52 Uhr

This is what happens if you get the matrix parameter wrong in the Convert filter in AviSynth. 

You know the 75% bars at the top of the chart are different than the bottom, correct? I have always thought they were legacy PAL vs. NTSC, not related to the question. Literature doesn't give much of a clue, but I suspect they are not 601 v. 709. But even if so, wouldn't the appearance be double the actual difference?

I never understood the luma implications of the ConvertTo command, which appear significant in Nick's example? But as the popular line goes, "You challenge me. I like that."

I just repeated some tests I did a decade or so ago after first reading Glenn Chan's provocative article, with no change in my thinking as reflected above. I used Mainconcept mpeg-2, which allows color transforms in the advanced settings.

http://www.glennchan.info/articles/technical/hd-versus-sd-color-space/hd-versus-sd-color-space.htm

Color space encoding tabs

The encoding tabs allow to verify if 609 (SD) or 709 (HD) matrices were used to encode component from RGB.
Note: The matrices are y = 0.213 * r + 0.715 * g + 0.072 * b for 709 and y = 0.299 * r + 0.587 * g + 0.114 * b for 601.

The red, green and blue tabs all should have the same luma value, if the correct matrices were used.

On the other hand, the Encoding Tabs are fully documented. I ran these twice; however, I welcome your image tests in case I made mistakes.

As you can see, I don't have a good reason to force colorspace transformation, as if it weren't being done already for me (in Vegas). A ≤1% luma shift in the "wrong" matrix is all I can measure. Maybe we'd see something after five generations of deliberate sequential errors? Fifteen years ago, I would have said differently, based entirely on untested presumptions and way too much fussiness to be a producer (then).

NickHope schrieb am 21.12.2018 um 07:01 Uhr
As far as the Belle Nuit pattern, do I record that back to my MiniDV tape, then transfer to the PC via Firewire, then render one option with rec601 and one with rec709 to compare?

No, just set your project to NTSC DV settings and imagine that the test chart is an NTSC DV clip that has been placed on the timeline. Unfortunately NTSC DV project properties templates have been removed in VP16 but you can restore them using Joelson's .reg file from that thread, or just match the project properties to one of your real NTSC DV clips and save a custom template.

AviSource("d:\fs.avi")
AssumeBFF()
ConvertToYV12(interlaced=true)
#ConvertToYV12(interlaced=true, matrix="Rec709")
QTGMC(Preset="Slower")
Spline36Resize(960,720)
AssumeFPS(59.94)

When you have a # in the code, isn't that just a note to the user? so that means: matrix="REC709" is not in the command?

Anything on a line after a # is not read by the script. So I use the # at the beginning to disable that line (known as "commenting out" the line). So I was just switching between that line and the one above it by moving the # to the start of one or the other. I left both lines in so you can see the 2 options I used in my test

To avoid any confusion,

ConvertToYV12(interlaced=true)

...is the same as...

ConvertToYV12(interlaced=true, matrix="Rec601")

How are you rendering? What program? What codec? Are you frameserving to it?

I haven't rendered a file yet other than what AVISynth has done. I imported the new QTGMC file back into Vegas just to see how it compared to the raw AVI. I noticed the QTGMC-file looks overall darker than the original file when both are in the same Timeline. Yet, when viewing in a non NLE program, like Windows Media there is no difference in brightness.

But you must have rendered in some program (e.g. VirtualDub 2) and using some codec (e.g. MagicYUV (or uncompressed)).

Difficult to troubleshoot your issue without knowing your whole process. Are you sure the video is just getting darker. It's more likely to actually have more or less contrast, than for the whole luminance to shift darker or brighter. Check the video scopes to see.

NickHope schrieb am 21.12.2018 um 07:18 Uhr

@Ehemaliger User Those are good points, and increase the argument for deinterlacing before authoring. The intended audience is also a factor; what's best for personal use, or for known playback scenarios, may be less appropriate for commercial sale. I doubt there are many, if any, 50p or 59.94p discs in the mainstream commercial market that have been produced from (majority) 25i/29.97i footage. Also I suspect ripping commercial discs, even for home use, is often forbidden in the small print. I actually have that stated in the first-play copyright notice on my own DVDs (last one produced in 2015).

NickHope schrieb am 21.12.2018 um 07:32 Uhr

This is what happens if you get the matrix parameter wrong in the Convert filter in AviSynth. 

You know the 75% bars at the top of the chart are different than the bottom, correct?...

@Musicvid Not sure exactly what you mean by that. In my screenshot I just wanted to draw attention to the shifts in the big fat colour bars which appear at the top and bottom of the original test chart, and (after rendering) in the centre of my screenshot. Those colour bars at the top and bottom of the original test chart have the same values.

I tried some encoding the Belle Nuit chart using MainConcept MPEG-2 with some different options on the advanced video tab. In each case the overall look of those color bars ends up the same, so for me those settings are doing something different from the matrix parameter in the Convert filter in AviSynth. What exactly were your advanced video settings for your 601 and 709 renders?

Musicvid schrieb am 21.12.2018 um 17:14 Uhr

This reminds me so much of the discussions a group of us used to have, which I miss.

Those colour bars at the top and bottom of the original test chart have the same values.

You know, Nick, I've had the same monitor for ten years, and no matter how I tilt the screen, I can't get the top and bottom bars to look the same (I know...).

Note to self: Check assumptions at the door, oldest first.

Plowing ahead, if I take like strips from each of your renders and superimpose them, scopes give me this:

Not far apart, maybe 1% fatter than my image.

For fun, I'm going to put my ringaround through your script and compare results. Probably not today.

My mpeg-2 settings were 1080 p30, stock 2-pass bitrate, and renders at 624-4* and 709.

* A guy on doom9 says it is 601 upgraded for hdmi, but I honestly don't know.

NickHope schrieb am 21.12.2018 um 17:46 Uhr
Plowing ahead, if I take like strips from each of your renders...

@Musicvid I'm afraid I'm not getting that part. What renders and what strips?

...My mpeg-2 settings were 1080 p30, stock 2-pass bitrate, and renders at 624-4* and 709...

Did you use those values in all the boxes on the advanced video tab ("Color primaries", "Transfer" and "Matrix coefficients") or just the last one? I tried both ways and couldn't see a shift in the result. I'm out of my depth with those settings, but I did wonder if they might cancel each other out if more than one was selected. Unfortunately there is no help provided for those settings.

Regarding the effect of 601 vs 709 in the AviSynth Convert matrix parameter, I recall clearly seeing the difference on John Meyer's real world HDV ballet footage. I'm sure he wouldn't mind me re-sharing this clip. At one stage I had that matrix wrong (709), and the colours were bothering me until I worked out that I needed to use 601 in the script when rendering AVI in Vdub, despite being in HD-land.

Musicvid schrieb am 21.12.2018 um 19:00 Uhr

 

What renders and what strips?

Like this, one each from your top (709) and bottom (601) renders.

Then superimposed using the Difference mask in Photoshop.

Then analyzed with Vegas scopes

Very close to my results mathematically, yet apparently subject to the observer's visual impression, mine included.

until I worked out that I needed to use 601 in the script when rendering AVI in Vdub, despite being in HD-land.

Bringing my thoughts full circle, that is pretty much the basis I used to make my original suggestion, which is to maintain 601 door to door. I guess the answer is, "whichever looks closer to the source" on your system.

I'll have a look at johmeyer's footage and get back.

 

john_dennis schrieb am 23.12.2018 um 21:28 Uhr

"Please tell me you guys would at least recommend deinterlacing? If not, why?"

I wouldn't deinterlace SD material for delivery on Blu-ray because:

  1. The Blu-ray spec already accommodates SD material in its natural form.
  2. If you deinterlace, you are forced to upscale to 720-59.94p in order to put your work on Blu-ray. So, it's a two-for. 
  3. If you upscale to 720-59.94p, you are guaranteed that the Blu-ray player will upscale your 720-59.94p once again because of the preponderance of 1920x1080 and 3840x2160 TVs and display panels in use. True 1280x720 panels are likely the least common pixel dimensions for the inventory of displays.

While bob-h makes a valid point about everything being progressive in a youtube, Netflix, Vimeo, streaming world, your stated current delivery destination was defined as optical media, Blu-ray.

While I don't know for certain which flag might be best for delivery of SD material on Blu-ray. I would wager a small amount that someone at the Blu-ray Disc Association thought about it.

He said, while deinterlacing some VHS captures from 1988 for local streaming.