variants/rtsp.sh assembles the complete firmware: DTB with a 24 MB ION heap for 2304x1296, Tuya-free APP with the SDK runtime, rebuilt RTSP server, dropbear, OTA, Wi-Fi and camcfg tools, DATA partition, patched env, and stages full.bin, partitions and both SD install sets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8.8 KiB
Local RTSP (+ ONVIF) on the AK3918AV130 — using the public Anyka SDK
Short answer to "are the OpenIPC parts useful?"
Yes — they point straight to the solution. OpenIPC's anyka-osdrv-ak3918av130
package doesn't bundle the closed userspace libs itself; it pulls them from a public
Anyka SDK: github.com/Link-WQS/ANYKA_130L_SDK, built for kernel 4.4.302-cip94 —
your exact kernel. That SDK ships everything needed for a local stream:
platform/sample/rtsp/— a ready RTSP sample, including a prebuiltak_rtsp_server_sample(36 KB)librtsp_server.so— an RTSP server librarylibmpi_venc(H.264),libplat_vi,libplat_isp_sdk,libapp_video,libapp_ats/its, audio libs — the full media pipeline- the prebuilt binary is ARM EABI5, dynamically linked to
/lib/ld-uClibc.so.0— the exact dynamic linker in your stock rootfs, so it runs without recompiling.
So the "private SDK" worry was wrong for the userspace stack. My earlier "needs a private build" was incorrect — this is assemblable from public parts.
What camera_flash_rtsp.bin contains
Built by toolkit/variants/rtsp.sh from the staged SDK blobs in toolkit/blobs/anyka-rtsp/:
- stock UBOOT/ENV/DTB/kernel 4.4.302-cip94/ROOTFS/CONFIG (unchanged)
- APP (2944 K) = Tuya-stripped userland + 23 SDK
.solibs +ak_rtsp_server_sample+rtsp.ini - DATA (2176 K) = writable jffs2 (overlay + your files)
- boot: loads the video modules (already in stock
main.sh:ak_isp,sensor_sc3332,ak_venc_adapter/bridge,ak_pcm,ak_uio), joins Wi-Fi, starts telnet + serial shell, then launches the RTSP server.
Streams (H.264, port 554):
rtsp://<camera-ip>/vs0— main, 1920×1080 @20, ~2048 kbpsrtsp://<camera-ip>/vs1— sub, 640×360 @20, ~400 kbps
(stream params + the ISP tuning path live in /usr/local/rtsp.ini, which is repointed to
your stock /usr/local/isp_sc3332.conf.)
Status: booted on hardware; RTSP libs load (libmpi_venc V3.0.02), stream pending validation
First on-device boot confirmed the big unknowns: the repartition took (9 MTD partitions,
DATA at 0x5e0000), the SDK userspace libs are ABI-compatible and load/run
(libmpi_venc V3.0.02 prints), and the SC3332 sensor probes. Two bring-up bugs were found
and fixed in the build:
- Wi-Fi driver needs the USB host stack first.
ATBM6x6x_wifi_usb.kodepends onusbcore(+cfg80211); load order isusb-common → usbcore → ak_hcd → cfg80211 → ATBM6x6x_wifi_usb. Without it:unknown symbol in moduleand nowlan0. - The RTSP binary hard-reads
/etc/config/rtsp.ini(ignores its argv), so the config is now copied there at boot.
Both are in variants/rtsp.sh. Still to confirm on your unit: that the encoder opens the
sensor and a client can actually pull the stream (see below).
Flash + bring-up
- Flash (keep
camera_flash.binas your restore image):flashrom -p ch341a_spi -w toolkit/out/camera_flash_rtsp.bin - One-time repartition at the U-Boot
=>prompt (adds the DATA partition;boot_normalrebuildsbootargsfrom${mtdparts}), thenreset:setenv mtdparts 'mtdparts=spi-nor:200k@0x0(UBOOT),4k@0x32000(ENV),4k@0x33000(ENVBK),64k@0x34000(DTB),1536k@0x44000(KERNEL),1008k@0x1c4000(ROOTFS),256k@0x2c0000(CONFIG),2944k@0x300000(APP),2176k@0x5e0000(DATA)' saveenv reset - Connect (telnet, once Wi-Fi is up) and watch the RTSP log:
telnet <camera-ip> cat /tmp/rtsp.log # encoder/RTSP init messages cat /tmp/local_bootstrap.log - View:
ffplay rtsp://<camera-ip>/vs0(or VLC → Open Network Stream).
Validation / troubleshooting (do these first)
- venc ↔ lib version match (the main risk). The kernel modules are your stock ones
(SDK ~V1.01); the userspace libs are from Link-WQS SDK. If
/tmp/rtsp.logshows venc/isp ioctl errors, swap the kernel modules for the OpenIPCanyka-osdrv-ak3918av130/files/kmodset (same SDK lineage, built for 4.4.302-cip94): drop them intotoolkit/src/app/modules/and rebuild, orinsmodthe matching ones over telnet to test. - ISP config. If the sensor won't open, the SDK may expect its own
isp_sc3332_mipi_2lane_av130.confformat. Pull it from the SDK's rootfs and pointrtsp.ini'sisp_confat it (edit/usr/local/rtsp.iniviarw /usr/local/rtsp.ini). - How it finds the config. The server is launched as
cd /usr/local && ak_rtsp_server_sample rtsp.ini. If it ignores the arg, it reads./rtsp.inifrom that cwd (why wecdthere first). - No watchdog is petted (Tuya service is gone). If the board resets ~1 min into boot,
add
[ -e /dev/watchdog ] && watchdog -t 5 /dev/watchdogearly inlocal_bootstrap.sh. - Everything in APP is read-only squashfs; use
rw /pathto edit a file persistently, or put test copies on/dataand adjustLD_LIBRARY_PATH.
Rebuild with your own Wi-Fi / tweaks
cd toolkit
WIFI_SSID='MyNet' WIFI_PSK='MyPass' ./variants/rtsp.sh
Edit toolkit/blobs/anyka-rtsp/rtsp.ini (resolution/bitrate) or swap libs/binary there and
rebuild. The 23 SDK libs + binary live in toolkit/blobs/anyka-rtsp/ (fetched from the
public SDK); re-fetch newer ones from Link-WQS/ANYKA_130L_SDK/platform/{lib,sample/rtsp}.
ONVIF (Profile S) — config + wiring are baked in; build + drop in the binaries
ONVIF is the discovery/metadata layer NVRs and apps use to auto-find the camera and learn
its RTSP URL. There's no prebuilt uClibc ONVIF binary, so you build the (small, open source)
onvif_simple_server — but everything around it is already set up in the image:
- Config
/usr/local/onvif/onvif.conf— tailored to this camera: two Profile S profiles pointing atrtsp://%s/vs0(1080p) andrtsp://%s/vs1(360p), H264, port 8080, no auth, PTZ/events off. (%s= device IP, filled at runtime.) - Launcher
/usr/local/onvif/start_onvif.sh— copies the config to/etc/onvif_simple_server.conf, creates the per-service CGI symlinks (device_service,media_service, …; the binary picks its service fromargv[0]), starts busybox httpd on :8080 serving/cgi-bin/, and startswsd_simple_server(WS-Discovery) advertisinghttp://<ip>:8080/cgi-bin/device_service. - Auto-start —
local_bootstrap.shalready runs the launcher on boot as soon as the binaries exist at/data/onvif/(so nothing happens until you drop them in).
Build the binaries
git clone https://github.com/roleoroleo/onvif_simple_server && cd onvif_simple_server
# Use an ARM cross toolchain. Build STATIC so the libc (musl/uClibc) doesn't matter —
# a static ARM binary runs fine on this kernel regardless of the rootfs libc.
export CC=<arm-cross>-gcc # e.g. the OpenIPC arm-openipc-linux-musleabi-gcc
# needs json-c + zlib + a crypto lib (mbedtls/libtomcrypt/wolfssl) cross-built for ARM;
# with no auth configured, WS-Security isn't exercised but the lib is still linked.
make -f Makefile.static CC=$CC HAVE_MBEDTLS=y \
INCLUDE="-I<deps>/include" LIBS_O="-L<deps>/lib -lmbedcrypto -ljson-c -lz -lpthread -lrt"
# outputs: onvif_simple_server wsd_simple_server onvif_notify_server
(If cross-building the deps is a hassle, grab prebuilt ARM onvif_simple_server/wsd_simple_server
from an OpenIPC or thingino rootfs — they ship these built for ARMv5.)
Drop them into the camera (over telnet)
mkdir -p /data/onvif/wsd_files
# scp/tftp from your build host into /data/onvif/ :
# onvif_simple_server wsd_simple_server
# wsd_files/* (WS-Discovery templates from the repo)
# any *_service_files the build expects (keep the repo's layout)
chmod +x /data/onvif/onvif_simple_server /data/onvif/wsd_simple_server
sh /usr/local/onvif/start_onvif.sh # or just reboot — it auto-starts
Test
- Discovery: ONVIF Device Manager,
onvif-cli, or add it in Frigate / Home Assistant / Blue Iris — it should appear and expose/vs0and/vs1. - Manual:
curl -s http://<ip>:8080/cgi-bin/device_service -d @GetSystemDateAndTime.xml
Notes / gotchas
- busybox runs anything under
/cgi-bin/as CGI, so no busybox patch is needed with the/cgi-bin/<service>URLs used here. If an ONVIF client instead expects/onvif/<service>URLs, either rebuild busybox with OpenIPC's0102-add-onvif-dir-support.patchor front it with lighttpd mapping/onvif/*→ the CGI, and update the-xXAddr instart_onvif.sh. - Edit identity/profiles in
toolkit/blobs/onvif/onvif.confand rebuild, or live-edit on the device withrw /usr/local/onvif/onvif.conf.
If this path stalls
The alternative is full OpenIPC (Majestic = RTSP, its onvif packaged), which replaces
the stock uClibc rootfs with OpenIPC's musl rootfs — see OPENIPC.md. The RTSP stack here
is the lighter route because it keeps your stock kernel + rootfs and just adds the SDK's own
server.