Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VStarcam: "bad access unit" debug messages #21

Open
lattice0 opened this issue Aug 21, 2021 · 1 comment
Open

VStarcam: "bad access unit" debug messages #21

lattice0 opened this issue Aug 21, 2021 · 1 comment
Labels
interop interoperability problem with another (often broken) RTSP implementation need-input Need input, usually from the issue reporter, to proceed

Comments

@lattice0
Copy link
Contributor

With the new modifications, I'm getting a stream with no errors but this warning:

[2021-08-21T05:32:37Z DEBUG retina::codec::h264] bad access unit (ended by mark) at ts 1147 (mod-2^32: 1147), npt 0.000
    errors are:
    * same timestamp as previous access unit
    NALs are:
      0: NalHeader { nal_ref_idc: 3, nal_unit_type: SliceLayerWithoutPartitioningNonIdr }

should it happen? I had no time to look into it deep and I can provide more info if needed. I was just testing if everything went well with the merge.

I don't get decoded frames yet but I think this has to do with what we talked before about the VCL thing etc. By the way, do you have a place for me to read about those without getting into tedious details about h264 encoding internals?

I cleaned my ffmpeg code, it compiles on the retina branch but have to send packets from retina to it. Gonna try to make the example soon so you can test with your cameras too, if you want

@scottlamb
Copy link
Owner

This is the new version of packet follows marked packet with same timestamp from #13—now a debug message rather than a hard error, in the interest of improving compatibility. Not sure if the bad data will be good enough for ffmpeg (or whatever). You can see if the .mp4 generated by the example plays or not.

If you set the log level on retina::codec::h264 to trace, you'll see log entries for all the access units, not just the ones with errors. It'd be interesting to see the one immediately before. The Reolink camera I'm working with will incorrectly end access units at SPS and PPS NALs, and I added code to prevent that:

retina/src/codec/h264.rs

Lines 499 to 511 in 59e513c

/// Returns true if we allow the given NAL unit type to end an access unit.
///
/// We specifically prohibit this for the SPS and PPS. Reolink cameras sometimes
/// incorrectly set the RTP marker bit and/or change the timestamp after these.
fn can_end_au(nal_unit_type: UnitType) -> bool {
// H.264 section 7.4.1.2.3 Order of NAL units and coded pictures and
// association to access units says "Sequence parameter set NAL units or
// picture parameter set NAL units may be present in an access unit, but
// cannot follow the last VCL NAL unit of the primary coded picture within
// the access unit, as this condition would specify the start of a new
// access unit."
nal_unit_type != UnitType::SeqParameterSet && nal_unit_type != UnitType::PicParameterSet
}

Possibly we should do something similar for the VStarcam.

@scottlamb scottlamb added the interop interoperability problem with another (often broken) RTSP implementation label Aug 21, 2021
@scottlamb scottlamb changed the title bad access unit VStarcam: "bad access unit" debug messages Jan 26, 2022
@scottlamb scottlamb added the need-input Need input, usually from the issue reporter, to proceed label May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop interoperability problem with another (often broken) RTSP implementation need-input Need input, usually from the issue reporter, to proceed
Projects
None yet
Development

No branches or pull requests

2 participants