[RESOLVED] 7 extra frames on 1 source

Support forum for DGDecNV
User avatar
MeteorRain
Posts: 130
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: 7 extra frames on 1 source

Post by MeteorRain »

I see.

Well, this is the part I don't understand well. They used to be very conservative on broadcasting (Hint: mpeg2 interlaced 1440x1080 SAR 2ch aac) but all in a sudden they are going to the moon (hevc 10bit 4k / 8k with open-gop rasl+radl and 22.2 channel latm aac audio). :scratch:
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky »

22 channel? That's insane.

BTW, just to help with your already excellent English, we say "all of a sudden".
User avatar
Boris
Posts: 92
Joined: Sun Nov 10, 2019 2:55 pm

Re: 7 extra frames on 1 source

Post by Boris »

We say, she say, speak for yourself. Who is broadcaster? We can blow up studio. Animals will not be harmed.
User avatar
Sherman
Posts: 576
Joined: Mon Jan 06, 2020 10:19 pm

Re: 7 extra frames on 1 source

Post by Sherman »

I'm so confused. Help me.
Sherman Peabody
Director of Linux Development
User avatar
MeteorRain
Posts: 130
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: 7 extra frames on 1 source

Post by MeteorRain »

:scratch: Thanks for the correction.

By the way, they used 22.2 channels so it's 24 in total :scratch: I don't even think there's any OSS decoder yet.
User avatar
Natasha
Posts: 150
Joined: Wed Nov 20, 2019 11:11 am

Re: 7 extra frames on 1 source

Post by Natasha »

Sherman, poor baby, come to me, I will help you.
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Re: 7 extra frames on 1 source

Post by Bullwinkle »

Sherman, you are a beloved child of the divine.

https://www.youtube.com/watch?v=2EaflX0MWRo (released version)
https://www.youtube.com/watch?v=Ma09CIqapwk (extended version)
https://www.youtube.com/watch?v=NlqJ44IpAJ0 (happy version)
https://www.youtube.com/watch?v=yqFz7T5v3iU (with lyrics)
https://www.youtube.com/watch?v=b-3eSxlgOhY (Motown remix)

Highest genius of the human spirit. RIP Levi Stubbs.

"When the world falls apart, some things stay in place
Levi Stubbs' tears run down his face."

-Billy Bragg
User avatar
Sherman
Posts: 576
Joined: Mon Jan 06, 2020 10:19 pm

Re: 7 extra frames on 1 source

Post by Sherman »

Thank you, Bullwinkle. But are emotions irrational? Should we suppress them? Is it an evolutionary mistake? How do emotions know what is right?
Sherman Peabody
Director of Linux Development
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Re: 7 extra frames on 1 source

Post by Bullwinkle »

Sherman, emotions are beautiful manifestations of the divine spirit that set us apart from microbes. Embrace the divine, and sing your joy!
User avatar
Sherman
Posts: 576
Joined: Mon Jan 06, 2020 10:19 pm

Re: 7 extra frames on 1 source

Post by Sherman »

Thanks, Bullwinkle! Think I got it:

https://www.youtube.com/watch?v=xhtzMwA5gJI
Sherman Peabody
Director of Linux Development
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky »

I've been working on the seeking issue. It's a doozy. Apparently, it's all caused by the RASL frames. My design assumes that the decoder always returns something for any coded frame. In fact I negotiated that with nVidia when I was working with them on the early CUVID rollout. But now, HEVC comes along with its Random Access Skipped Leading (RASL) frames. A Random Access Decodable Leading (RADL) frame is a frame that is decodable starting with the associated IDR/I, while a RASL is a frame that is not decodable and must be skipped by the decoder upon random access, meaning the decoder returns nothing for them. Oops, there goes my assumption and we need a hack or a re-design. So we have to cogitate on this and decide how to do things given the reality of RASL frames. All hands are on deck, even Natasha is looking into it.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky »

Hey that wasn't so bad. After discussing this with Curly :salute: I realized we could keep a count of leading RASLs per GOP and then just use that to adjust how many frames we need to decode starting at the IDR/I to get to the seeked-to frame. It seems to be working fine. I'll do some heavy regression testing and then give y'all a slipstream.
User avatar
Curly
Posts: 712
Joined: Sun Mar 15, 2020 11:05 am

Re: 7 extra frames on 1 source

Post by Curly »

Glad to be of assistance, Rock! Nyuk.
Curly Howard
Director of EAC3TO Development
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky »

Glad I decided to test all my HEVC streams with this fix! I found one that starts like this:

SPS 390168
PPS 390234
PREFERRED TRANSFER CHARACTERISTICS 18
0:RASL 0 -23
1:RASL 0 -22
2:RASL 0 -21
3:RASL 0 -20
4:RASL 0 -19
5:RASL 0 -18
6:RASL 0 -17
7:CRA 390719 2 -16
8:TRAIL 0 -15
9:TRAIL 0 -14
10:TRAIL 0 -13
11:TRAIL 0 -12
12:TRAIL 0 -11
13:TRAIL 0 -10
14:TRAIL 0 -9

Yes, there are 7 leading frames that cannot be decoded. And we can't try to start decoding at the previous GOP because this is the first GOP. So I decided to treat this the same way as for AVC leading B frames: repeat the first decodable frame 7 times. The idea is to preserve audio sync.

Formally, an HEVC stream must start with an IDR, but people cut streams all the time and produce such technically illegal streams.

Still have a bunch more to test but things are looking good.
User avatar
MeteorRain
Posts: 130
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: 7 extra frames on 1 source

Post by MeteorRain »

Yea it happened to TV caps a lot. They use CRAs instead of IDRs as many as possible, so the program can only be cut on CRAs. It's wise to make it work like AVC leading B frames and keep the rest of the video in sync and seek accurate.

Thanks for all the work guys!
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky »

Thank you, MeteorRain. Wouldn't have happened without you!

Found another one with 184 leading RADLs preceding an IDR. What is that all about? Anyway, it works fine with the fix.
User avatar
MeteorRain
Posts: 130
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: 7 extra frames on 1 source

Post by MeteorRain »

Yea occasionally they insert IDRs at some commercials or between programs, it's kinda random. Sometimes it's just full CRAs across multiple programs.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky »

It's the 184 leading RADLs that has me baffled. Must be for compression efficiency in some way, I suppose.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: 7 extra frames on 1 source

Post by Rocky »

Fixed in slipstream 205. Marking resolved.
User avatar
MeteorRain
Posts: 130
Joined: Fri Jul 25, 2014 4:04 pm
Location: New Jersey

Re: [RESOLVED] 7 extra frames on 1 source

Post by MeteorRain »

Thanks, the seek accuracy is back!
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: [RESOLVED] 7 extra frames on 1 source

Post by Rocky »

Ah, with your endorsement we can all sleep soundly again. :salute:
Post Reply