Skip to content

Commit 2f06185

Browse files
jimmy-rubin-workJimmy Rubinisak-jakobsson
authored andcommitted
vdoencodeclient: Add support for AVIF
Co-authored-by: Jimmy Rubin <jimmyrn@axis.com> Co-authored-by: Isak Jakobsson <isakj@axis.com>
1 parent 8bcbb19 commit 2f06185

File tree

7 files changed

+190
-79
lines changed

7 files changed

+190
-79
lines changed

.github/workflows/vdostream.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ jobs:
1515
axis-os: ["12.7.53"]
1616
arch: ["armv7hf", "aarch64"]
1717
vdo-format: ["h264", "h265", "y800", "jpeg", "nv12"]
18+
include:
19+
- axis-os: "12.7.53"
20+
arch: "aarch64"
21+
vdo-format: "avif"
22+
chip: "artpec9"
1823
env:
1924
EXREPO: acap-native-examples
2025
EXNAME: vdostream

vdostream/README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
# A vdo stream based ACAP application on an edge device
44

5-
This README file explains how to build an ACAP application that uses the vdostream API.
5+
This README file explains how to build an ACAP application that uses:
6+
7+
- the [Video capture API (VDO)](https://developer.axis.com/acap/api/native-sdk-api/#video-capture-api-vdo) to fetch frames from e.g. a camera.
68

79
Together with this README file, you should be able to find a directory called app. That directory contains the "vdoencodeclient" application source code which can easily
810
be compiled and run with the help of the tools and step by step below.
911

10-
This example illustrates how to continuously capture frames from the vdo service, access the received buffer contents as well as the frame metadata. Captured frames are logged in the Application log.
12+
This example illustrates two different ways of retrieving video frames from VDO.
13+
14+
- Snapshot, if only one video frame is wanted the vdo_stream_snapshot API is convenient. Typically used for JPEG or AVIF.
15+
- Continously capturing video frame from the VDO service.
16+
17+
When a video buffer is retrieved, access the received buffer contents as well as the frame metadata. Captured frames are logged in the Application log.
1118

1219
## Getting started
1320

@@ -18,11 +25,14 @@ vdostream
1825
├── app
1926
│ ├── LICENSE
2027
│ ├── Makefile
28+
│ ├── manifest.json.avif
2129
│ ├── manifest.json.h264
2230
│ ├── manifest.json.h265
2331
│ ├── manifest.json.jpeg
2432
│ ├── manifest.json.nv12
2533
│ ├── manifest.json.y800
34+
│ └── panic.c
35+
│ └── panic.h
2636
│ └── vdoencodeclient.c
2737
├── Dockerfile
2838
└── README.md
@@ -31,6 +41,7 @@ vdostream
3141
- **app/LICENSE** - Text file which lists all open source licensed source code distributed with the application.
3242
- **app/Makefile** - Build and link instructions for the application.
3343
- **app/manifest.json** - Defines the application and its configuration.
44+
- **app/panic.c/h** - Utility for exiting the program on error
3445
- **app/vdoencodeclient.c** - Application to capture the frames using vdo service in C.
3546
- **Dockerfile** - Assembles an image containing the ACAP Native SDK and builds the application using it.
3647
- **README.md** - Step by step instructions on how to run the example.
@@ -59,7 +70,7 @@ docker build --platform=linux/amd64 --tag <APP_IMAGE> --build-arg VDO_FORMAT=<VD
5970
```
6071

6172
<!-- textlint-disable terminology -->
62-
<VDO_FORMAT> is the video compression format. Supported values are *h264*, *h265*, *jpeg*, *nv12* and *y800*
73+
<VDO_FORMAT> is the video compression format. Supported values are *avif*, *h264*, *h265*, *jpeg*, *nv12* and *y800*
6374
<!-- textlint-enable -->
6475

6576
<APP_IMAGE> is the name to tag the image with, e.g., vdoencodeclient:1.0
@@ -85,16 +96,20 @@ vdostream
8596
├── app
8697
│ ├── LICENSE
8798
│ ├── Makefile
99+
│ ├── manifest.json.avif
88100
│ ├── manifest.json.h264
89101
│ ├── manifest.json.h265
90102
│ ├── manifest.json.jpeg
91103
│ ├── manifest.json.nv12
92104
│ ├── manifest.json.y800
105+
│ └── panic.c
106+
│ └── panic.h
93107
│ └── vdoencodeclient.c
94108
├── build
95109
│ ├── LICENSE
96110
│ ├── Makefile
97111
│ ├── manifest.json
112+
│ ├── manifest.json.avif
98113
│ ├── manifest.json.h264
99114
│ ├── manifest.json.h265
100115
│ ├── manifest.json.jpeg
@@ -150,6 +165,15 @@ Application log can be found directly at:
150165
http://<AXIS_DEVICE_IP>/axis-cgi/admin/systemlog.cgi?appname=vdoencodeclient
151166
```
152167

168+
#### Output - format avif
169+
170+
```sh
171+
----- Contents of SYSTEM_LOG for 'vdoencodeclient' -----
172+
173+
vdoencodeclient[49013]: Starting stream: avif, 640x360
174+
vdoencodeclient[49013]: frame = 0, type = avif, size = 2700
175+
```
176+
153177
#### Output - format h264
154178

155179
```sh

vdostream/app/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PROG1 = $(shell jq -r '.acapPackageConf.setup.appName' manifest.json)
2-
OBJS1 = $(PROG1).c
2+
OBJS1 = $(PROG1).c panic.c
33
PROGS = $(PROG1)
44
DEBUG_DIR = debug
55

vdostream/app/manifest.json.avif

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"schemaVersion": "1.8.0",
3+
"acapPackageConf": {
4+
"setup": {
5+
"friendlyName": "vdoencodeclient_avif",
6+
"appName": "vdoencodeclient",
7+
"vendor": "Axis Communications",
8+
"embeddedSdkVersion": "3.0",
9+
"runOptions": "--format avif --frames 1",
10+
"runMode": "never",
11+
"version": "1.0.0"
12+
}
13+
}
14+
}

vdostream/app/panic.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright (C) 2025, Axis Communications AB, Lund, Sweden
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "panic.h"
18+
19+
#include <stdarg.h>
20+
#include <stdio.h>
21+
#include <stdlib.h>
22+
#include <syslog.h>
23+
24+
// Function definition for panic
25+
__attribute__((noreturn)) __attribute__((format(printf, 1, 2))) void panic(const char* format,
26+
...) {
27+
va_list arg;
28+
va_start(arg, format);
29+
vsyslog(LOG_ERR, format, arg);
30+
va_end(arg);
31+
exit(1);
32+
}

vdostream/app/panic.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Copyright (C) 2025, Axis Communications AB, Lund, Sweden
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#pragma once
18+
19+
#include <stdarg.h>
20+
21+
// Function declaration for panic
22+
__attribute__((noreturn)) __attribute__((format(printf, 1, 2))) void panic(const char* format, ...);

0 commit comments

Comments
 (0)