Observation about "Rendered to Black" problem

Leee wrote on 3/27/2012, 11:58 AM
I apologize if this has already been discussed or is "old news", but I have found that a lot of the times I view a "black rendered" video made by Vegas, it can be viewed unblackened, in living color in good old Windows Media Player.

So while Winamp, Quicktime, RealPlayer, Nero Kwik Player, and the rest show black, many times I can view the clip normally in WMP.

I'm sure someone can tell me why this is, OR it might come as a complete surprise. Just passing along my little bit of observation....

Comments

TheRhino wrote on 3/27/2012, 1:07 PM
You may be encountering a different problem where the video file rendered is incompatible with different media players... The problem we are discussing here on the Forums is where the majority of the rendered video is OK except for a small portion. At some point during the render Vegas reached a small clip or portion of the video & decided to render just that portion black.

Try placing the rendered footage back on the timeline. In my case Vegas shows that it the small portion is black - so whether I render it to another video format, a Blu-ray disc or DVD disc it will appear black. The only solution is a re-render which 4/5 times turns-out OK.

Again, it's not the entire render - just random portions here or there...

Workstation C with $600 USD of upgrades in April, 2021
--$360 11700K @ 5.0ghz
--$200 ASRock W480 Creator (onboard 10G net, TB3, etc.)
Borrowed from my 9900K until prices drop:
--32GB of G.Skill DDR4 3200 ($100 on Black Friday...)
Reused from same Tower Case that housed the Xeon:
--Used VEGA 56 GPU ($200 on eBay before mining craze...)
--Noctua Cooler, 750W PSU, OS SSD, LSI RAID Controller, SATAs, etc.

Performs VERY close to my overclocked 9900K (below), but at stock settings with no tweaking...

Workstation D with $1,350 USD of upgrades in April, 2019
--$500 9900K @ 5.0ghz
--$140 Corsair H150i liquid cooling with 360mm radiator (3 fans)
--$200 open box Asus Z390 WS (PLX chip manages 4/5 PCIe slots)
--$160 32GB of G.Skill DDR4 3000 (added another 32GB later...)
--$350 refurbished, but like-new Radeon Vega 64 LQ (liquid cooled)

Renders Vegas11 "Red Car Test" (AMD VCE) in 13s when clocked at 4.9 ghz
(note: BOTH onboard Intel & Vega64 show utilization during QSV & VCE renders...)

Source Video1 = 4TB RAID0--(2) 2TB M.2 on motherboard in RAID0
Source Video2 = 4TB RAID0--(2) 2TB M.2 (1) via U.2 adapter & (1) on separate PCIe card
Target Video1 = 32TB RAID0--(4) 8TB SATA hot-swap drives on PCIe RAID card with backups elsewhere

10G Network using used $30 Mellanox2 Adapters & Qnap QSW-M408-2C 10G Switch
Copy of Work Files, Source & Output Video, OS Images on QNAP 653b NAS with (6) 14TB WD RED
Blackmagic Decklink PCie card for capturing from tape, etc.
(2) internal BR Burners connected via USB 3.0 to SATA adapters
Old Cooler Master CM Stacker ATX case with (13) 5.25" front drive-bays holds & cools everything.

Workstations A & B are the 2 remaining 6-core 4.0ghz Xeon 5660 or I7 980x on Asus P6T6 motherboards.

$999 Walmart Evoo 17 Laptop with I7-9750H 6-core CPU, RTX 2060, (2) M.2 bays & (1) SSD bay...

NickHope wrote on 3/27/2012, 1:13 PM
This is definitely a different problem to the one I have in 10.0e. The clips that render to black for me can be seen as empty white clips on the timeline, and they play black both in the Vegas preview and as rendered files in any media player. I restart Vegas and they restore themselves. I personally haven't seen a black frames problem (yet). For me it's the entire clip.
TheRhino wrote on 3/27/2012, 3:18 PM
I too have had the clips go white/blank on the timeline which is an easy fix just by restarting. The BIG issue is when Vegas 10e or 11.595 renders a small clip or portion of a clip to black within a larger 2-3 hour render. As much as I can tell, during the render the preview screen will also show black when Vegas is rendering to black.

In 10e the black is continuous for several seconds whereas for 11.595 it was intermittent - less than a second each on & off until the render passed that portion (typically just one clip) of video. Usually just one or two clips or beginning portions of those clips will render to black... Everything else renders fine. These clips are typically all the same codec - either Blackmagic m-jpeg or Cineform... The entire video can be 1.5 to 2.0 hours of HD video the black portions are only a few seconds.

Of course any black means re-rendering. When I am crunched for time, I create a new track on top and cut-out the bad (black) sections. I then re-render and Vegas does not need to re-encode the video until it gets to the places I cut-out. This saves some time on the corrected render but it is still a big waste of time vs. had it been correct the first time...

Workstation C with $600 USD of upgrades in April, 2021
--$360 11700K @ 5.0ghz
--$200 ASRock W480 Creator (onboard 10G net, TB3, etc.)
Borrowed from my 9900K until prices drop:
--32GB of G.Skill DDR4 3200 ($100 on Black Friday...)
Reused from same Tower Case that housed the Xeon:
--Used VEGA 56 GPU ($200 on eBay before mining craze...)
--Noctua Cooler, 750W PSU, OS SSD, LSI RAID Controller, SATAs, etc.

Performs VERY close to my overclocked 9900K (below), but at stock settings with no tweaking...

Workstation D with $1,350 USD of upgrades in April, 2019
--$500 9900K @ 5.0ghz
--$140 Corsair H150i liquid cooling with 360mm radiator (3 fans)
--$200 open box Asus Z390 WS (PLX chip manages 4/5 PCIe slots)
--$160 32GB of G.Skill DDR4 3000 (added another 32GB later...)
--$350 refurbished, but like-new Radeon Vega 64 LQ (liquid cooled)

Renders Vegas11 "Red Car Test" (AMD VCE) in 13s when clocked at 4.9 ghz
(note: BOTH onboard Intel & Vega64 show utilization during QSV & VCE renders...)

Source Video1 = 4TB RAID0--(2) 2TB M.2 on motherboard in RAID0
Source Video2 = 4TB RAID0--(2) 2TB M.2 (1) via U.2 adapter & (1) on separate PCIe card
Target Video1 = 32TB RAID0--(4) 8TB SATA hot-swap drives on PCIe RAID card with backups elsewhere

10G Network using used $30 Mellanox2 Adapters & Qnap QSW-M408-2C 10G Switch
Copy of Work Files, Source & Output Video, OS Images on QNAP 653b NAS with (6) 14TB WD RED
Blackmagic Decklink PCie card for capturing from tape, etc.
(2) internal BR Burners connected via USB 3.0 to SATA adapters
Old Cooler Master CM Stacker ATX case with (13) 5.25" front drive-bays holds & cools everything.

Workstations A & B are the 2 remaining 6-core 4.0ghz Xeon 5660 or I7 980x on Asus P6T6 motherboards.

$999 Walmart Evoo 17 Laptop with I7-9750H 6-core CPU, RTX 2060, (2) M.2 bays & (1) SSD bay...

NickHope wrote on 3/28/2012, 3:17 AM
Anyone know if scripting can detect black clips or frames?
Grazie wrote on 3/28/2012, 3:29 AM
Just got this yesterday, in Rendering to MC MPEG2. Imported to DVDA - Black "sections". No rhyme nor reason. Mid-Render.

Started back on it today (2:00am), and it's working as it should.

G

johnmeyer wrote on 3/28/2012, 12:30 PM
Anyone know if scripting can detect black clips or frames?Yes Nick. Absolutely.

Starting with Vegas 8.1 (the first 64-bit version) I encountered black frames, both individual, single frames, as well as all-black output, when rendering to NTSC MPEG-2 using the DVD Architect templates for the MainConcept MPEG-2 encoder built into Vegas.

I have since encountered this same problem in Vegas 10 and 11. Since both these version have so many problems (I skipped Vegas 9, so I can't comment on that) I generally try to use Vegas 7.0d or 8.0c to render to MPEG-2 (I never had a single problem with either of these two versions). However, once in awhile, I need to use Vegas 10 (never yet had a project that actually required 11, although I certainly have used it several times in order to see if it was a viable release).

In those cases, I ALWAYS run the resulting MPEG-2 file through an AVISynth script which outputs the frame numbers of any frame (or frame) that falls below a threshold. It is a very simple script. I also have many, many other scripts which look for other things and then output similar text files that can be copy/pasted into Vegas, into the Edit Details --> Markers area. Those other scripts include those which can look for frames that are completely different from both the preceding and succeeding frames (such as what you get when a photographer's flash goes off); scripts that detect scene changes (you then create the markers and then use a script to cut all events at the marker locations); scripts that find duplicate frames (a common problem with analog capture cards); and much more.

Here is the simplest form of the AVISynth blank frame detection script. I have several versions of this (for instance, one of these scripts only outputs the frame number of the first frame that falls below the black threshold, something that is useful if you have a large string of blank frames and don't want to deal with dozens of markers in a row).

The blankthreshold in the script below is set well above pure black because I often use a variation of this script to find commercials in analog OTA captures. For finding a pure black frame, I'd set it to 1 or 2 (the programmer in me never likes using values that are at the absolute limit because of all the boundary conditions I've encountered over the years when programming).

#Script to find blank frames
#Next lines only needed if reading an MPEG-2 file
loadPlugin("c:\Program Files\AviSynth 2.5\plugins\MPEGDecoder.dll")
loadPlugin("c:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")

#Specify the name and location of the output file
filename = "m:\output_blank_frames.txt"

#Specify the threshold that will be considered black (0 = pure black)
global blankthreshold=28

#Use SetMTMode statements only if you have the multi-thread version of AVISynth
SetMTMode(5,0)

#Use the mpegsource statement if your video is MPEG-2
AVISource("E:\fs.avi").killaudio()
#mpegsource("E:\Jones_89.mpg").killaudio()

SetMTMode(2)

#Only look at half the fields (speeds up processing
i=separatefields.selectodd.ConvertToYV12()

#Temporarily un-comment next line to display the average luma value on screen
#to help determine threshold value.
#ScriptClip(i,"Subtitle(String(AverageLuma(i) ))" )

#Write the frame number
WriteFileIf(last, filename, "(AverageLuma(i)<blankthreshold)", "current_frame+1", append = false)



NickHope wrote on 3/29/2012, 12:56 AM
Thanks John, that will be very useful and a lot quicker than watching my 2-hour movie for the XXth time, trying not to fall asleep.

How about detecting black frames using scripting in Vegas? I doubt it's possible but asking anyway.
johnmeyer wrote on 3/29/2012, 1:24 AM
How about detecting black frames using scripting in Vegas? I doubt it's possible but asking anyway.The Vegas scripting capability only permits controlling Vegas itself; it provides absolutely no access to the video (or audio) itself.

This is what makes AVISynth so useful. AVISynth lets the script look at the actual video pixels themselves, and then make decisions based on that information.

It is possible that an fX plugin could be developed, because the video content IS made available to the fX. However, the other hurdle to overcome would be some way to force the plugin to scan the entire project. Most fX are designed to look at just one frame, and to then alter the pixels in that frame. Once again, the advantage of AVISynth is that it can scan the entire video file and output the results of that scan.

mjr38 wrote on 4/3/2012, 8:22 AM
Ok, I'm confused :( To test my understanding of how to use John's Avisynth script, I created a test project comprised of just 2 generated solid color media events separated by 4 frames of "emptiness" on the timeline, and rendered this to a DVDA videostream. Viewing this in WMP confirmed that there were indeed black frames between the 2 color events. However, running the mpg through the Avisynth script, with a "blankthreshold" = 2, failed to detect these black frames. In fact, upping the threshold to 4 was required for them to be detected, and a subsequent "debug" run showed that the AverageLuma of these black frames was 3.8+. Replacing the empty gap between the 2 color events by a solid black generated media event (no matter whether black was defined as [0,0,0] or [16,16,16] in the media generator) gave essentially the same AverageLuma for these frames. Since I'm sure that John has verified by experience that a threshold of 2 does pick up Vegas' wrongly encoded "black" frames, I'm wondering just what is in such erroneous mpg streams that result in an AverageLuma < 2?
malowz wrote on 4/3/2012, 9:11 AM
avs2avi can be used to "run" the avs to scan the black frames with the script
riredale wrote on 4/3/2012, 10:56 AM
John, I thought you had written something back in the day of V7 to detect black frames, but maybe I'm mistaken.

In any event, for those rare times when Vegas glitches and puts black frames on my timeline, I seem to recall that there's only 2 or 3 in a row. Maybe a script that detects "no more than 3 black frames in sequence" would be useful to quickly see if a project needs repair.

EDIT: I mean something written with V7 in mind. My understanding is that scripting for V8 and later is not compatible.
johnmeyer wrote on 4/3/2012, 11:20 AM
I thought you had written something back in the day of V7 to detect black framesIsn't that what I posted above??


Since I'm sure that John has verified by experience that a threshold of 2 does pick up Vegas' wrongly encoded "black" frames, I'm wondering just what is in such erroneous mpg streams that result in an AverageLuma < 2?I made no representation about what threshold number would be required to detect Vegas black frames. As I said above, and as I said in the script comments, you have to temporarily remove the comment from the line of code that puts the actual averageluma values on screen, find a few black frames on your own, and then set the threshold to some number a little above whatever values are displayed.

The threshold value needed is going to depend on what codec you use (the whole 15:235, 0:255 thing ...), what is actually causing the black frames (are they really black??); and also whether there is anything left around the edges (such as what you get in some analog video). I generally use a larger rather than a smaller value.

Also, if my goal is to get on with the job, I also use another function, not shown above, that once a black frame is detected, automatically synthesizes and inserts a replacement frame using motion estimation (MVTools2). I usually don't do this, and instead try to find some workflow that doesn't produce black frames (such as using an older version of Vegas that hasn't been screwed up).


Maybe a script that detects "no more than 3 black frames in sequence" would be useful to quickly see if a project needs repair.This script detects all black frames below a threshold. I have slight variations to this script that will only create a marker for the first black frame in a sequence (to avoid generating dozens of markers during a long fade to black transition). I also have other scripts that detect "isolated" frames that are completely different than the frame on either side (like a frame spoiled by a still photographer's strobe flash). It's pretty easy to do just about anything, and usually only takes one or two lines. However, it is my experience that trying to be too clever about how to look for the bad frames ends up missing things. My recommendation is to set the threshold higher than what you think you will need and then be prepared for spending 5-10 minutes using Ctrl-RightArrow to go to each new marker and see what is there. The reason for this is that none of us really know how or why Vegas is broken, so we don't know if the blank frames come in ones, twos, threes, etc.




Christian de Godzinsky wrote on 4/3/2012, 1:09 PM
Good grief ... where have we come? I fully understand that a tool for checking automatically for black frames comes in handy (for many of us- I will probably use it too - thanks a lot)!

BUT - have you realised what you actually are doing - you are creating a tool to check the correctness of the output of a professional NLE application? All credits for that, but isn't the situation IS a little bizarre? Is this a recognized problem by SCS - or not? Will we see a repair - or not? I would appreciate a direct comment from SCS (for both this - and the "replaced media" bug)...


Christian

WIN10 Pro 64-bit | Version 1903 | OS build 18362.535 | Studio 16.1.2 | Vegas Pro 17 b387
CPU i9-7940C 14-core @4.4GHz | 64GB DDR4@XMP3600 | ASUS X299M1
GPU 2 x GTX1080Ti (2x11G GBDDR) | 442.19 nVidia driver | Intensity Pro 4K (BlackMagic)
4x Spyder calibrated monitors (1x4K, 1xUHD, 2xHD)
SSD 500GB system | 2x1TB HD | Internal 4x1TB HD's @RAID10 | Raid1 HDD array via 1Gb ethernet
Steinberg UR2 USB audio Interface (24bit/192kHz)
ShuttlePro2 controller