This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Parse h.264 bytestream with startcodes

0

Hi,

I receive a h264 bytestream via rtp. To analyze the stream in wireshark, I set the protocol (rtp) and the decoding options (h264 dynamic payload type to 96). My problem is, that my stream includes h264 startcodes (0x00000001) before nal header types. The fist byte of the startcode wireshark parses as nal unit header and of course detects an undefined type.

Can anyone help me to find out a filter that ignores the first 4 bytes of the h.264 payload or parse the h264 stream correct as byetestream separated with startcodes?

Thank you, janina

asked 22 Aug '17, 22:01

janina's gravatar image

janina
6112
accept rate: 0%


One Answer:

0

That looks as if there's either a bug in the H.264 dissector or the byte stream is somehow invalid. Could you file a bug on the Wireshark Bugzilla, and attach a capture that demonstrates the problem?

answered 23 Aug '17, 14:24

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196
accept rate: 19%

Thank you for your answer. I don't think that its a bug from wireshark. Rather I didn't quite understand something. Nobody else has a problem like me and I coded the whole video pipeline. I will elucidate my setup. I have written a small programm that gets a video stream from a Logitech C920 webcam and sends it to a server. I get the raw h264 bytestream from the cam and pack the frames into simple 12byte-header rtp packets (without optional extensions). This is the video I'm monitoring.

https://ibb.co/fKQ66k) In the stream you see a sps, pps followed by an idr frame. Is it a regular H264 stream if I send the Bytestream with startcodes via rtp? Or is this format not specified? Should I really write a bug ticket?

(24 Aug '17, 00:14) janina

From the code it seems like when calling the h264 dissector directly it does not take the start code into account. But dissect_h264_nal_unit() does. I'm not sure if your format is "legal" e.g according to RFC specification of H.264 over RTP. If you remove the start code in your script, it should work.

(24 Aug '17, 04:00) Anders ♦

As an alternative it might be possible to write a LUA script to handle your format e.g skip the start code befor calling the h264 decoder.

(24 Aug '17, 04:02) Anders ♦