https://github.com/angrycoding/sps-parser
H.264 sequence param parser (sps) written in pure C with no dependencies
https://github.com/angrycoding/sps-parser
exp-golomb golomb h264 pps sps video
Last synced: 10 months ago
JSON representation
H.264 sequence param parser (sps) written in pure C with no dependencies
- Host: GitHub
- URL: https://github.com/angrycoding/sps-parser
- Owner: angrycoding
- Created: 2020-04-13T19:39:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-09T07:24:41.000Z (over 1 year ago)
- Last Synced: 2025-03-21T16:11:12.122Z (10 months ago)
- Topics: exp-golomb, golomb, h264, pps, sps, video
- Language: C
- Size: 330 KB
- Stars: 20
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 💜If you like my projects, you can support me.
| Coin/Symbol | Network | Adress |
|------|---------|--------|
| Bitcoin (BTC) | BTC | 1LU7DtLiKkWe3aAXbhRhNAMUFdrapWuAHW |
| Tether (USDT) | TRC20 | TK7f7TXozWVbkHxdArAJd2rELu725q1Ac5 |
| Tether (USDT) | TON | UQDI4e7xm_B7O_REaYd5CoyEz1Ki08t0EPlUim022_K9B2xa |
# sps-parser
H.264 sequence param parser (sps) written in pure C with no dependencies.
Sequence parameter set is decribed somewhere in here: https://tools.ietf.org/html/rfc3984 (see below for more detailed format description).
Primary use is for obtaining stream dimensions, but you can take it as a boilerplate and extract anything you need (fps and god knows what else is there). Usage:
```c
int main(int argc , char *argv[]) {
uint8_t buffer[] = "J00AH41qBQBboQAAAwABAAADADKE";
uint32_t dimensions = sps_parser(buffer);
// 1280x720
printf("width = %d\nheight = %d\n", dimensions >> 16, dimensions & 0xFFFF);
strcpy(buffer, "J00AH41qCwEmhAAAAwAEAAADAMoQ");
dimensions = sps_parser(buffer);
// 704x576
printf("width = %d\nheight = %d\n", dimensions >> 16, dimensions & 0xFFFF);
strcpy(buffer, "J00AH41qCwPaEAAAAwAQAAADAyhA");
dimensions = sps_parser(buffer);
// 704x480
printf("width = %d\nheight = %d\n", dimensions >> 16, dimensions & 0xFFFF);
}
```
