Strict AVC and TS files

Support forum for DGDecNV
Post Reply
DAE avatar
renols
Posts: 149
Joined: Tue Feb 22, 2011 2:34 am

Strict AVC and TS files

Post by renols »

Hi.

I read some posts in here, which suggested that turning on "Strict AVC" might be a good idea, and it also seems to be the default now.

So I though I would enable it.

Today I was going to encode some .ts file I had recorded, and suddenly it isn't possible to open the avs file in VirtualDub, AVSPmod or VirtualDub2.

It actually took me a while to think about the only change I had made was to enable "Strict AVC" in the settings. So I went to turn it off again, and everything works as before.

I am running 64 bit, Windows 10, DG build 198, Nvidia GTX 1060 Ti with driver 325.31 (yes, I know it not the most recent).

When I try to open the avs file when "Strict AVC" is enabled I get this message:

-----
avisynth open failure
System exception - Access violation
(test.avs line 6)
-----

Line 6 is: DGSource("test.dgi")

The dgi file is 100% the same, no matter if "Strict AVC" is enabled or not.

All I have to do to make it fail is to enable or disable "Strict AVC" in the config and close the gui, or change it manually between 0 and 1 in the ini file.

What can I do to help troubleshoot this? Do you need the .ts file in question.

The problem does not happen when using files ripped from a bluray disk. I can change "Strict AVC" between 0 and 1 in this case without problems. It seems to only happen on the .ts file I have recorded.

The log file left after demuxing looks like this:

Stream Type: Transport [188]
Video Type: AVC
Profile: High
Level: 4
Coded Size: 1920x1088
SAR: 1:1
Display Size: 1920x1080
Frame Rate: 25.000000 fps
Colorimetry: BT.709 [1]
Frame Structure: MBAFF
Frame Type: I
Coded Number: 1
Playback Number: 1
Frame Repeats: 0
Field Repeats: 0
Bitrate:
Bitrate (Avg):
Bitrate (Max):
Audio Stream: 42: MPEG1 L2 2ch 48 192
Elapsed: 0:00:19
Remain: 0:00:00
FPS:
Info: Finished!

Anything I can do to help, just let me know.

The raw .ts file is "only" 2,8 GB, so I can send it if you maybe have and FTP I can send it to.

Thanks in advance

renols
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: Strict AVC and TS files.

Post by Rocky »

Must be something strange in the TS file. I'll send you my FTP details for you to upload the stream.

EDIT: My guess is that the stream has only I frames and no IDR or RPS frames (you can check that in the DGI file). DGDecodeNV should not crash in this case, so your stream will be valuable for my testing. One possibility would be to automatically disable strict in the case that there are no IDR/RPS.
DAE avatar
renols
Posts: 149
Joined: Tue Feb 22, 2011 2:34 am

Re: Strict AVC and TS files.

Post by renols »

Hi.

File is on the FTP.

Checked the DGI file and I see "I" lines and no "IDR/RPS" lines.

renols
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: Strict AVC and TS files.

Post by Rocky »

Thank you renols, got it. Added code to detect strict_avc=1 and no IDR/RPS, and throw an error advising to turn off strict_avc. I just silently updated build 199 as I didn't want a full slipstream for this small error check. Re-download build 199.

Marking resolved.
DAE avatar
renols
Posts: 149
Joined: Tue Feb 22, 2011 2:34 am

Re: Strict AVC and TS files.

Post by renols »

Hi.

I have never really had a problem with "Strict AVC" being turned off like the post showed with badly decoded frames. That I know of at least. If it happens, is it just some frames here and there, or will it be easy to spot the deccoding errors because there will be tons of them?

Have been using "Strict AVC=0" for many years, and never experienced anything. I just changed it now, since I read in a post, that it might be good to enable it :-)

I am doing quite a bit of encoding of tv stuff I record and want to keep, since it takes up less space, and it would not be ideal if there was an error message appearing everytime I wanted to open such a file in VirtualDub.

So, maybe just setting "Strict AVC" to 0 for that instance of dgdecnv would be preferable. Seems like when doing the dgi creation it doesn't matter if it is 0 or 1 in the ini file. The problem doesn't seem to appear until the dgi file is opened by an avs file later on, that it can fail depending on the setting.

I haven't checked any of the other channels I have that are 1920x1080i, 25 fps, so I don't know if it is a common thing in the broadcast world, not to have IDR/RPS frames but just I frames.

Anyone else have an input on this, or is everyone else just using DG for bluray stuff?

Otherwise just do as you find best.

renols
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Re: Strict AVC and TS files.

Post by Rocky »

Your reply came a bit too late for me, as I had already revised 199 (see my revised post above). Sorry about that.

The one thing I do not want is people getting badly decoded frames out-of-the-box, which can happen with default strict_avc=0. You now understand the issues and you can happily set strict_avc=0 for your uses. And then, hopefully, if you ever get a bad frame you'll remember about this. Be aware that these bad frames occur only for random access (and the first frame is always accessed as if random). So for linear play you won't get any surprises later in the stream.

BTW, for those sharp intellects that are wondering, there is no way to tell for sure if an I frame (not IDR!) is going to display broken. The DPB processing is very complicated, especially with B frame pyramids. Even when there are known missing references, they may not result in bad display. So I'm not going there. You don't really want me to have to duplicate NVDec parsing and decoding, right? It's an API. We use it.

BTW2, the AVC specification requires the first coded frame of a video sequence to be an IDR frame. So, if I wanted to be pedantic, I could say your stream is illegal and you get what you deserve. But I'm way too nice, and too pragmatic, to take such a stance. Right, Bullwinkle? And BTW3, where is the Mighty Moose? Haven't seen him in a while.
DAE avatar
cvonk
Posts: 5
Joined: Thu Apr 22, 2021 7:43 pm

[RESOLVED] Strict AVC and TS files

Post by cvonk »

Some background on these non-compliant files:

Dear old Canon HG10/HF10/HF100 imposed a file limit of 2 GB on .mts files. When rolling over to the next file, it continues the H.264 feed instead of restarting it.

Using dgdecnv2053 to decode either subsequent files, I see these
DGSource: Stream is missing IDR/RPS frames; try disabling Strict AVC
Acknowliging the possibility of bad frames, and setting StrictAVC to 0 in DGIndexNV.ini works around this problem.

FYI, I just learned that simply concatenating these files (COPY /B in Windows) will make a compliant file. (see
dvinfo.net)
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

[RESOLVED] Strict AVC and TS files

Post by Rocky »

Welcome to the forum cvonk!

That's great information. Thank you.

BTW, loading all the files at once in DGIndexNV is equivalent to joining them.
Post Reply