"Audio and video: wireshark captures rtp packets and extracts H264 naked stream data"

I. Introduction

Wireshark captures network RTP packets, extracts h264 naked stream data to generate naked stream files.

Second, add the Lua script to the wireshark installation directory

insert image description here

Re-open wireshark, click "Tools" -> Video -> Export H264 / Export H265 in the upper menu bar.
insert image description here

Three, UDP packets are parsed into RTP packets

Locate the data packet to be analyzed according to the destination IP and source IP. The original data is generally transmitted through UDP packets, which need to be parsed into RTP packets first.
insert image description here

Select, right-click the mouse:
insert image description here

Choose to parse as RTP
insert image description here

After clicking OK, you can see that wireshark parses the UDP packet into an RTP packet. Displays that the payload type of the RTP packet is 96.
insert image description here

Fourth, set the load type value of H264

According to the RTP payload type value obtained in the previous step, set the payload type value of H264 to 96.
Click Edit -> Preferences in the upper menu bar
insert image description here

Select to expand Protocols, find the H264 protocol, and fill in 96.
insert image description here

Click OK, and you can see that wireshark recognizes the RTP packet as an H264 packet.
insert image description here

Five, use the script to extract H264 bare stream data

Click Export H264 in the second step.
insert image description here

Click Export All to see xxx.h264 generated OK!
insert image description here

Finally, a wireshark_temp temporary directory will be generated in the user directory, and a xxx.h264 file will be generated. The file can be played with ffplay.
insert image description here

6. There is a link to the script file

https://download.csdn.net/download/qq_40709487/86814897

Guess you like

Origin blog.csdn.net/qq_40709487/article/details/127500448
Recommended