從wireshark中獲取H264碼流詳解
1、首先從https://github.com/volvet/h264extractor打包下載
2、讀README.md 全文如下:
# h264extractor
wireshark plugin to extract h264 stream from rtp packets, support Single NAL Unit Mode(RTP Packetization Mode 0), FU-A and STAP-A. In addition, opus stream is supported as well.
# How to use h264extractor
* Copy rtp_h264_extractor.lua to the directory where wireshark was installed
* edit init.lua, make sure "disable_lua = false" and add "dofile(DATA_DIR.."rtp_h264_extractor.lua")"
* when open pcap file in wireshark, decode as RTP and configure the H264 dynamic payload types.
* Menu - Tools - Extract h264 stream from RTP
# How to use opus extractor
* Copy rtp_opus_extractor.lua to the directory where wireshark was installed
* edit init.lua, make sure "disable_lua = false" and add "dofile(DATA_DIR.."rtp_opus_extractor.lua")"
* when open pcap file in wireshark, decode as RTP.
* Menu - Tools - Extract opus stream from RTP
# TODO
* H265 extractor
# Reference
* https://wiki.wireshark.org/Lua
* https://tools.ietf.org/html/rfc6184
* https://tools.ietf.org/html/rfc7587
* https://tools.ietf.org/html/rfc7798
其中H264部分的大意為:
編輯安裝目錄下的init.lua檔案(如WIN10系統可能編輯不了,需要在其它盤下編輯好後,複製過去),需確認
disable_lua = false,在檔案最後"dofile(DATA_DIR.."rtp_h264_extractor.lua")"。
把rtp_h264_extractor.lua複製到安裝目錄下,開啟wireshark在工具選單多了一項:Extract h264 stream from RTP,
如下圖所示:
開啟wireshark, 在解碼為當前值選擇RTP。
檢視rtp包的payload
type(如96),那麼在wireshark工具欄選擇編輯-首選項->protocols->H264,
把H264 dynamic payload types設成96。
設定完以上,執行工具-Extract h264 stream from RTP,
執行後,會生成dump.264,一般會放在與碼流檔案同一個路徑下。
參考:
http://blog.csdn.net/volvetandanny/article/details/47087641
https://github.com/volvet/h264extractor
https://wiki.wireshark.org/Lua
http://www.lua.org/