wiki/en/majestic-streamer.md

4.6 KiB

OpenIPC Wiki

Table of Content

Majestic Streamer

Preamble

Majestic is a video streaming application, the heart of our firmware (in relation to camera/video surveillance functionality). Majestic is configurable via /etc/majestic.yaml file, and has many features/services enabled by default. Unneeded options can be switched off for better security and performance.

With firmware running, you can access the camera using URLs below (192.168.1.10 is an example of camera IP address):

Live video

Still image

  • http://192.168.1.10/image.jpg - image snapshot in JPEG format. Supports specific image parameters in URL, e.g. /image.jpg?width=640&height=360&qfactor=73&color2gray=1: -width and height - size of picture to scale original image.
    • qfactor - JPEG quality factor between 1 and 99.
    • color2gray - force to grayscale conversion.
    • crop - crop image in format 16x16x320x320, where first numbers are left and top image coordinates and others are image width and height.
  • http://192.168.1.10/image.heif - image snapshot in HEIF format, use stream parameter to specify channel (the same approach as for RTSP channels)
  • http://192.168.1.10/image.yuv - image snapshot in YUV420 format.
  • http://192.168.1.10/image.dng - raw image snapshot from the sensor in Adobe DNG format (only for v>=2 HiSilicon processors).
Tips:

To convert YUV image to a more common image format, use convert command from ImageMagick software. Run it like this:

convert -verbose -sampling-factor 4:2:0 -size 1920x1080 -depth 8 image.yuv image.png

where 1920x1080 is the picture resolution of video0, and .png is the target image format.

Audio input

Tips:

To play audio stream use ffplay utility from ffmpeg package.

ffplay -ar 48000 -ac 1 -f s16le http://192.168.1.10/audio.pcm
ffplay -ar 48000 -ac 1 -f alaw http://192.168.1.10/audio.alaw
ffplay -ar 48000 -ac 1 -f mulaw http://192.168.1.10/audio.ulaw
ffplay -ar 8000 -ac 1 -f alaw http://192.168.1.10/audio.g711a

To play audio on camera speaker over network (Hisilicon/Goke only):

curl -T test.pcm http://10.216.128.66:8888/play_audio

PCM file can be prepared using sox program:

sox speech.mp3 -t raw -r 8000 -e signed -b 16 -c 1 test.pcm

API

Night API endpoint (make sure nightMode is enabled in Majestic config, or use it from the camera without restrictions):

Monitoring