当前位置:网站首页>How to judge the video frame type in h265 in golang development
How to judge the video frame type in h265 in golang development
2022-06-23 22:50:00 【Tsingsee green rhino video】
Many of our projects are through Golang Compilation of , such as EasyNVR、EasyGBS、EasyDSS etc. , about Golang Use , We've always been studying . stay Golang in , The corresponding parsing package is provided in the requirements , for example h265parser.
You can use the corresponding analytic function ParseSliceHeaderFromNALU Returns the corresponding frame type :
payloads, _ := h265parser.SplitNALUs(payload)
payloadsLen := len(payloads)
if payloadsLen == 0 {
return
}
sliceType, e := h265parser.ParseSliceHeaderFromNALU(payloads[5])
if e == nil {
if sliceType == h265parser.SLICE_I {
} else if sliceType == h265parser.SLICE_P {
} else {
log.Printf("Not support %s", sliceType.String())
}
log.Printf(sliceType.String())
}Under the analysis of h265 stream ( Byte stream mode ),nal How units are divided into types .
Here's our last paragraph h265 Code stream fragment of :
Look at the nal Cell segmentation .
seek 0x000001 perhaps 0x00000001, The following rules : Every NALU There is a start code in front 0x000001,3bits. If NALU The type is vps,sps,pps, Or the decoding order is the first AU One of the first NALU, Add another... Before the start code 0x00. The first video stream NALU Add... Before the start code of 0x00.
In practical analysis , It doesn't have to be so complicated , Just find 0x000001 perhaps 0x00000001 that will do .
We also take the content in the figure above for analysis , The above code stream nal Split into :
First frame : 0000 0001 4001 0c01 ffff 0160 0000 0300 0003 0000 0300 0003 00ba 9702 40 Second frame : 00 0000 0142 0101 0160 0000 0300 0003 0000 0300 0003 00ba a00f 0804 47f9 65e4 91b6 1c5e 4924 fe79 fcf2 ffff ffcf e7f3 f3f9 d9 Frame 3 : 00 0000 0144 01c1 9095 8112 The fourth frame : 0000 0126 01af 1380 790b dc5c 557c 74…
Here are NAL Type analysis :
The type judgment method is the value that the first byte after the separator is shifted one bit to the right First frame :0x40 >> 1, obtain 0x20, Decimal system 32, by NAL_VPS Second frame :0x42 >> 1, obtain 0x21, Decimal system 33, by NAL_SPS Frame 3 :0x44 >> 1, obtain 0x22, Decimal system 34, by NAL_PPS The fourth frame :0x26 >> 1, obtain 0x13, Decimal system 19, by NAL_IDR_W_RADL
边栏推荐
- Consequences of website construction without SSL authentication are websites without SSL authentication reliable
- Role of API service gateway benefits of independent API gateway
- What are the steps required for TFTP to log in to the server through the fortress machine? Operation guide for novice
- Method of thread synchronization in kotlin
- This article takes you to understand the JVM class loading mechanism
- SLSA: 成功SBOM的促进剂
- How to lossless publish API gateway why do you need API gateway?
- API gateway monitoring function the importance of API gateway
- How do new investors open accounts by speculation? Is online account opening safe?
- Statistics of clinical trials - Calculation of tumor trial endpoint
猜你喜欢

Hackinglab penetration test question 8:key can't find it again

【技术干货】蚂蚁办公零信任的技术建设路线与特点

Application practice | Apache Doris integrates iceberg + Flink CDC to build a real-time federated query and analysis architecture integrating lake and warehouse

为什么你的数据图谱分析图上只显示一个值?

為什麼你的數據圖譜分析圖上只顯示一個值?

SAVE: 软件分析验证和测试平台

Ant group's self-developed tee technology has passed the national financial technology product certification
Mysql中的触发器定义及语法介绍

脚本之美│VBS 入门交互实战

游戏安全丨喊话CALL分析-写代码
随机推荐
Role of API service gateway benefits of independent API gateway
How to set up external links in website construction
Grpc: quickly configure the general API to obtain process meta information
[tcapulusdb knowledge base] update data example (TDR table)
What should I do if the RDP fortress server connection times out? Why should enterprises use fortress machines?
Tcapulusdb Jun · industry news collection
Notes to nodejs (III)
Micro API gateway Middleware
First talk about the necessary skills of Architecture
PHPMailer 发送邮件 PHP
sql server常用sql
Production of labels for table products
Mysql中的触发器定义及语法介绍
Redis6.x.x build rediscluster cluster
Introduction to tcapulusdb lossless relocation
為什麼你的數據圖譜分析圖上只顯示一個值?
How to set the protective strip in the barcode
在宇宙的眼眸下,如何正确地关心东数西算?
What are the application flow restrictions of API gateway framework?
Talk about the problems and solutions of IT enterprise fixed assets management system