hvc1: Last 2 frames are black (or red)

Andrew-Stevenson wrote on 11/10/2023, 6:30 PM

Hi,

Vegas 21 appears unable to playback or render the last 2 frames of much of the footage shot with an iPhone 13. The last two frames are always black, or red if I am using proxies.

Can anyone advise something to try which might help fix this issue with HEVC hvc1 footage?

Back in August, I opened a support case with Magix, sending them a demonstration video and a sample clip that illustrated the issue (see below). In a series of email exchanges they had me try the following steps:

1) Enable QuickTime plug-in

2) Provide Windows System Information

3) Turn "GPU acceleration of video processing" to off

4) Set Dynamic RAM Preview to 0

5) Install QuickTime 7.6

6) See if converting the footage into another format helps with the matter

None of these steps worked (except 6) and I was already converting footage to another H264 to workaround this defect. It's a very time consuming process, which is why I opened the support case. I told Magix this and that I was really looking for the defect to be resolved and asked if a resolution would be forthcoming as a patch. They stopped replying.

I retested on the latest build, Vegas Version 21 Build 187, and the defect is still present.

Demonstration:

https://drive.google.com/file/d/1PhHTwnfETAi6D0orEAJ44pToIIxuj5XT/view?usp=[..]

The clip with the issue:

https://drive.google.com/file/d/1YyYETYgn36FT_8lC2JPtFVi56X6UTwV6/view?usp=[..]

Operating System
  Platform: Windows 10.0 (64-bit)
  Version: 10.00.19045
  Language: English
  System locale: English
  User locale: English

Processor
  Class: AMD Ryzen 9 3900X 12-Core Processor
  Identifier: AuthenticAMD
  Number of processors: 24
  MMX available: Yes
  SSE available: Yes
  SSE2 available: Yes
  SSE3 available: Yes
  SSSE3 available: Yes
  SSE4.1 available: Yes
  SSE4.2 available: Yes

Display
  Primary: 3840x2160x32

Memory
  Physical memory: 32,650.1 MB
  Paging memory available: 37,514.1 MB


[Display]
DirectX version:    12.0 
GPU processor:        NVIDIA GeForce RTX 3060
Driver version:        546.01
Driver Type:        DCH
Direct3D feature level:    12_1
CUDA Cores:        3584 
Resizable BAR        No
Core clock:        1882 MHz 
Memory data rate:    15.00 Gbps
Memory interface:    192-bit 
Memory bandwidth:    360.05 GB/s
Total available graphics memory:    28612 MB
Dedicated video memory:    12288 MB GDDR6
System video memory:    0 MB
Shared system memory:    16324 MB
Video BIOS version:    94.06.25.00.A2
IRQ:            Not used
Bus:            PCI Express x16 Gen4
Device ID:        10DE 2504 88181043
Part Number:        G190 0051

 

General
Complete name                            : C:\Users\Andrew\Videos\Vegas Test\CP_00025.MOV
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   0000.00 (qt  )
File size                                : 1.05 GiB
Duration                                 : 3 min 47 s
Overall bit rate                         : 39.5 Mb/s
Frame rate                               : 50.000 FPS
Encoded date                             : 2023-07-04 09:46:08 UTC
Tagged date                              : 2023-07-04 09:49:56 UTC
Writing library                          : Apple QuickTime
dateRecorded                             : 2023:07:04
cinema.p3.exposureMode                   : Center
cinema.p3.focusMode                      : AFC
cinema.p3.iso                            : 49
cinema.p3.shutterSpeed                   : 1/4785
cinema.p3.shutterAngle                   : 4º
cinema.p3.whiteBalanceMode               : WB Lock
WhiteBalanceKelvin                       : 5274
WhiteBalanceTintCc                       : 2
cinema.p3.toneMapping                    : Local
cinema.p3.cameraName                     : Back Camera
cinema.p3.stabilizationMode              : Standard
com.apple.quicktime.software             : Cinema P3 Pro Camera
com.apple.quicktime.creationdate         : 2023-07-04T09:46:08Z

Video
ID                                       : 2
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L5.1@Main
Codec ID                                 : hvc1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 3 min 47 s
Source duration                          : 3 min 47 s
Bit rate                                 : 39.4 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 50.000 FPS
Minimum frame rate                       : 46.154 FPS
Maximum frame rate                       : 54.545 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                       : 0.095
Stream size                              : 1.04 GiB (100%)
Source stream size                       : 1.05 GiB (100%)
Title                                    : Core Media Video
Encoded date                             : 2023-07-04 09:46:08 UTC
Tagged date                              : 2023-07-04 09:49:56 UTC
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : hvcC

Audio
ID                                       : 1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 3 min 47 s
Source duration                          : 3 min 47 s
Bit rate mode                            : Constant
Bit rate                                 : 64.0 kb/s
Channel(s)                               : 1 channel
Channel layout                           : M
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 1.74 MiB (0%)
Source stream size                       : 1.74 MiB (0%)
Title                                    : Core Media Audio
Encoded date                             : 2023-07-04 09:46:08 UTC
Tagged date                              : 2023-07-04 09:49:56 UTC

Comments

Former user wrote on 11/10/2023, 7:34 PM

The 2 black frames I don't think are playable frames, but rather Vegas is adding to the end.

 

The last playable frame is frame 11377, this is also true for Vegas.

There is a non playable frame 11378 which is maybe causing this?

In Resolve frame 11377 is duplicated at frame 11378, it doesn't have the black frames at the end.

john_dennis wrote on 11/10/2023, 8:03 PM

@Andrew-Stevenson

Turn on Quantize to frames and Show Unquantized Event Edges and report.

I didn't have any problem rendering 11,379 frames from your test sample with Vegas Pro 21-187 out of the box.

mark-y wrote on 11/10/2023, 8:09 PM

"Preview" mode, as opposed to Good and Best, uses "nearest neighbor" rather than "bicubic" scaling, giving you a faster, but 4x less accurate image. It's a natural consequence; are you able to observe the problem at Preview/Full setting, or does it just slow it down?

Exhale.

Former user wrote on 11/10/2023, 8:23 PM
 

I didn't have any problem rendering 11,379 frames from your test sample with Vegas Pro 21-187 out of the box.

 

@john_dennis check for duplicate frames at the end, I am only seeing 11377 unique frames

bvideo wrote on 11/10/2023, 10:53 PM

In case it helps:

In V21 build 187 I get the last frame duplicated into a partial last frame, showing a non-quantized red line at the end of the event, but only when I have the preferences -> file IO [x] Enable experimental HEVC decoding checked. That selects so4compoundplug.dll for the decoder, which in past releases mangled the length of HEVC events by various means: dropping frames in front, looping in back or both when dropping into the timeline, or maybe sooner if the clip is first added to the Vegas media window.

Without "experimental" enabled, I don't see a problem. (Rendering & proxy not tried)

Former user wrote on 11/10/2023, 11:09 PM

@bvideo I figured that was the case with @john_dennis playing the part of the unreliable narrator in this Vegas Mystery Thriller by saying he's using default settings but actually using experimental decoder.

However it's still curious that OP and myself see the black frames and you don't

EricLNZ wrote on 11/11/2023, 4:27 AM

with @john_dennis playing the part of the unreliable narrator in this Vegas Mystery Thriller by saying he's using default settings but actually using experimental decoder.

@Former user Please clarify as I cannot find anything to suggest this. But it wouldn't be the first time I've missed something.

Former user wrote on 11/11/2023, 5:10 AM

@EricLNZ I didn't try the experimental decoder but thought that could explain how he had a frame count of 11379, due to the explanation by @bvideo. I'm reasonably certain there are only 11377 plyable frames. BUT Maybe it's due to a difference in GPU decoders

Andrew-Stevenson wrote on 11/11/2023, 5:12 AM

Thanks to everyone for taking the time to look at the clip and offer suggestions. To keep the thread tidy, I have replied to everyone's questions below.

 

@Former user

Frame 11,378 is visible in timeline but is black in the preview window
Frame 11,379 is visible in timeline but is black in the preview window

@mark-y

I put the play indicator on frame 1,379 and switched preview between Draft (Full), Preview (Full), Good (Full) and Best (Full).

When switching between modes in the preview window, it is a lottery whether the frame is rendered or completely black. I think there is some other factor at work too. For example in the sequence below, it has both worked and failed in Draft (Full).
Draft (Full) -> Frame appears correctly in preview window
Preview (Full) -> Frame appears black in preview
Good (Full) -> Frame appears black in preview
Draft (Full) -> Frame appears black in preview
Preview (Full) -> Frame appears black in preview
Good (Full) -> Frame appears black in preview
Best (Full) -> Frame appears black in preview
Draft (Full) -> Frame appears correctly in preview window
Preview (Full) -> Frame appears black in preview

@john_dennis

Enable Quantize to frames is already checked
I turned on 'Show unquantized event edges'. The end of the clip does not have a red indicator on it and the frames fill the entire space on the time line allocated to them for 11,378 and 11,379.

@bvideo

I turned on Enable experimental HEVC decoding but still did not see a red quantization error indicator. Instead, it now screws up another frame at the end. Three frames 11,376, 11377 & 11,378 at the end of the clip are now showing 3 frames from the beginning of the clip (instead of solid black or the correct content).

mark-y wrote on 11/11/2023, 5:18 AM

When switching between modes in the preview window, it is a lottery whether the frame is rendered or completely black. I think there is some other factor at work too. For example in the sequence below, it has both worked and failed in Draft (Full).
Draft (Full) -> Frame appears correctly in preview window
Preview (Full) -> Frame appears black in preview
Good (Full) -> Frame appears black in preview
Draft (Full) -> Frame appears black in preview
Preview (Full) -> Frame appears black in preview
Good (Full) -> Frame appears black in preview
Best (Full) -> Frame appears black in preview
Draft (Full) -> Frame appears correctly in preview window
Preview (Full) -> Frame appears black in preview

I am unable to duplicate your observations. Optimal graphics drivers installed?

Unquantized end frames with HEVC and high-bit source are common and expected. I have two hours of ProRes I am working on now, and vestigial "frames" are the rule, with a couple of exceptions. I just trim them back on the timeline.

Search the forum for answers; I sense you have an anomoly and not a showstopper. Best of luck..

john_dennis wrote on 11/11/2023, 12:00 PM

"...Vegas Pro 21-187 out of the box." means:

  1. It is the way the Vegas Creative Software developers left it after doing an in-place upgrade from 21-108 to 21-187.
  2. I neither changed it nor looked at it since the upgrade.

These are my Project Properties

My Observations

The audio in this video clip is silent at least six (6) frames before the last video frame. In the long run, it's unlikely that @Andrew-Stevenson will use every clip without trimming. My experience with hitting the record button on cameras is that I usually trim something from every shot.

I've had cameras that failed to record three frames worth of audio on the front and back of every clip. I found a script (Trim Frames) from the Happy Otter that allows me to deal with this scenario easily.

Andrew-Stevenson wrote on 11/11/2023, 1:58 PM

@john_dennis

I trimmed the last 6 frames off the clip and Vegas started playing it correctly. I will take a look at the Happy Otter tools to trim clips as an alternative to converting them all to H264.

My workaround up to now has been to convert the files to H264 using Prism Plus. Vegas is always able to play to play these files correctly. Interestingly, comparing this version to the now trimmed original side by side in Vegas reveals the H264 audio comes 3 frames later than the audio in the original! In the image below, the H264 shows as only 5 frames longer than the trimmed original because it was actually 1 frame shorter than the original. I actually thought the H264 conversion would have the same number of frames and the same audio alignment as the original clip but it looks like that is not the case.

If I play the original clip outside of Vegas in VLC (and others), I don't see any blank frames so I am inclined to think this is a Vegas problem.

bvideo wrote on 11/11/2023, 4:25 PM

I think "experimental" was a distraction, sorry.

***Not trying it any more***

Just now, though, I had another quick look and saw that frame 11345 stepped backwards, seeming to duplicate 11343 and then 11346 duplicates 11344.

Then I started over and used the menu item "Add at Project Frame Rate" to get from the vegas media file entry to the timeline. This time, there was no anomaly at 11345 but 11338 had distortion (at several preview qualities.

Is my system so much different from everybody else's (W10 22H2, i5 11400 w/ intel UHD 720).

How much does the variable frame rate nature of that file affect all these observations?

Last changed by bvideo on 11/11/2023, 6:40 PM, changed a total of 1 times.

Dedicated: Vegas 20, 21, & 22, i7 8700k (UHD 630), 32 gig ram, ssd & 2 spinning units.

General purpose: i5 11400 (UHD 730), 32 gigs, ssd, 1 spinning unit (Vegas 21 & 22)

Former user wrote on 11/11/2023, 6:12 PM

"...Vegas Pro 21-187 out of the box." means:

  1. It is the way the Vegas Creative Software developers left it after doing an in-place upgrade from 21-108 to 21-187.
  2. I neither changed it nor looked at it since the upgrade.

@john_dennis I had a look at your frame 11379 as best I could given the small size in the screen recording, it appears to be my 11377. From what I've observed now with some editors or players there's only 2 right answers, ending on 11377 frame, or 11376 frame, Those that can only show last frame as 11376 correctly show the right frame, with 1 playable frame missing.

Your last frame should not be 11379 as it doesn't exist

@bvideo Yeah I had a look then, saw the same strangeness with experimental decoder.

@Andrew-Stevenson Had a look at some iphone14HEVC 10bit as opposed to your 8bit, it shows on timeline correctly.

bvideo wrote on 11/11/2023, 6:52 PM

My other PC, W11 I7-8700K Intel UHD 630, acts differently. Here, frames 11378 and 11379 are black and there is nothing wrong at frame 11343 and 11344. However, I notice Windows as back-graded my graphics driver to a pretty old 26.20.100.7642. I'll update and try again later.

bvideo wrote on 11/11/2023, 7:05 PM

I've updated my Intel UHD 630 driver to 31.0.101.2114 (it's the newest I think, but it's a year old).

Now it acts more like my other machine. The last two frames are normal. But frame 11338 and 11339 are distorted.

(not using "experimental")

Former user wrote on 11/11/2023, 8:36 PM

@bvideo I think you're right it's some strangeness with variable frame rate and Vegas. I have compared scene detects on Resolve and Vegas before and found they operated the same, but on this file scene detect finds scene s changes on OP's original file, while Resolve did not. There should be no reason with this shot for it to detect scene changes.

Further I ran Vegas scene detect on the HEVC 10bit transcodes from Resolve and shutter encoder, Vegas did not detect any scene changes. Stranger still I expected to find black frames at the scene detect locations, but didn't. Using compositing mode Difference and comparing original file to the transcodes, I can not match them for the entire shot , there's some sort of drift, but when comparing the Resolve and Shutter encodes, they match perfectly except for the first 10seconds where timing is slightly off

EDIT: This is all fake news, I forgot to return to the new GPU decoder after looking at the file with experimental decoder

mark-y wrote on 11/12/2023, 9:05 AM

 I actually thought the H264 conversion would have the same number of frames and the same audio alignment as the original clip but it looks like that is not the case.

Any long-GOP conversion introduces its own audio offset in apparent disregard for the original; it can sometimes be downright annoying, especially when it results in a mismatch of the respective stream lengths, causing unquantized frame edges from some encoders

john_dennis wrote on 11/12/2023, 9:35 AM

"I actually thought the H264 conversion would have the same number of frames and the same audio alignment as the original clip but it looks like that is not the case."

When I saw this...

Frame rate mode                          : Variable
Frame rate                               : 50.000 FPS
Minimum frame rate                       : 46.154 FPS
Maximum frame rate                       : 54.545 FPS

... my expectations were much more pessimistic than yours.