You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, on line 233, why bytes.Contains(nalu, []byte{0x00, 0x00, 0x00, 0x01}) instead of bytes.HasPrefix? The Contains call will need to scan through the entire packet, which has a cost.
What is the motivation for removing annex-b encoding, and on which cameras have you seen this?
Thanks!
The text was updated successfully, but these errors were encountered:
I've got some more information which will help explain why I've asked this question:
I have 3 HikVision cameras, and they have confused me for a long time, but I finally figured it out:
These cameras send RTSP packets without start codes (i.e. there is no 00.00.01 or 00.00.00.01 prefix to the packets). BUT, the packets are "Annex-B" encoded, because they have "emulation prevention bytes" added. In other words, in the byte stream I find a lot of 00.00.03.01 sequences. I have verified this by trying all permutations of decoding/encoding, etc, and testing it out on ffmpeg.
So what I am saying, is that it seems clear from this example that the presence of start codes is not 1:1 correlated with Annex-B escaping. And because of this, I'm not sure that it is a good idea to automatically remove the Annex-B encoding if you detect start codes.
Here's a reference to the code I'm referring to:
gortsplib/pkg/format/rtph264/decoder.go
Line 233 in a99cc55
I have two questions:
bytes.Contains(nalu, []byte{0x00, 0x00, 0x00, 0x01})
instead ofbytes.HasPrefix
? TheContains
call will need to scan through the entire packet, which has a cost.Thanks!
The text was updated successfully, but these errors were encountered: