x-ipcviewer

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 1 Imported by: 0

README

X-IPCViewer

GitHub GitHub tag (latest SemVer) GitHub last commit GitHub go.mod Go version

IP camera viewer for X11.

Features

  • mpv as the video player.
  • Main and sub stream.
  • Layout view.
    • Auto grid.
    • Manual placement.
  • Fullscreen view.

Key Bindings

Key Mouse Action
q Quit
1-9 2 x Left Click Toggle Fullscreen View
0 Activate Layout View

Configuration

Located at ~/.x-ipcviewer.yml.

Keys are NOT case sensitive.

# Keep streams playing when they are not in view.
Background: false

# Layout for windows. [auto, manual]
Layout: auto

# Manual layout for windows, 'Layout' must be 'manual'.
# Define x, y, w (width), and h (height) as ratios of the full width and height.
# Ratios can be fractions or numbers.
# Coordinates start from the top left corner.
LayoutManual:
  - X: 0
    Y: 0
    W: .5
    H: 1
  - X: 0.5
    Y: 0
    W: 1/2
    H: 1/2
  - X: 1/2
    Y: 1/2
    W: 1/2
    H: 1/2

# Mpv player configuration.
Player:
  GPU: auto # The hardware decoding api to use. (--hwdec=<api>)
  Flags: [] # Mpv flags.

# List of windows.
Windows:
  - Main: rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0 # Main stream used in fullscreen and/or normal view.
    Sub: rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=1 # Sub stream used in normal view. (optional)
    LowLatency: true # Enable low-latency profile and disable cache. Should be used for streams from IP cameras.
  - Name: Foo video # Name for logging purposes.
    Main: /tmp/foo.mp4
    Flags: # Extra mpv flags.
      - --no-keepaspect # Stretch window.
      - --glsl-shader=/tmp/nonlinear_stretch.glsl # https://gist.github.com/sarahzrf/c9909aee70e3656895820f20ac395956

Setup

This guide is for headless Debian 11 systems. Restart after finishing the guide.

Installation

Run the following command.

sudo apt install xserver-xorg xinit mpv

Create the directory ~/.local/bin/.

Download the binary and place it in ~/.local/bin/.

Start On Login

Create file at ~/.xinitrc with the following content.

#!/bin/sh
[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile
exec x-ipcviewer --config-watch-exit

Add the following content to the end of ~/.profile.

if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
  exec startx
fi

Automatic Login

Run sudo systemctl edit getty@tty1 and add the following block to it. username should be changed to the user who will run the program.

[Service]
ExecStart=
ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin username %I $TERM

Enable Audio (Optional)

Run the following command.

sudo apt install pulseaudio

Hide Mouse When Not Moving (Optional)

Run the following command.

sudo apt install unclutter

Add the following content to ~/.xprofile.

unclutter &

To Do

  • Add more layouts.
  • Add configurable mpv flags for each window.
  • Add left click to focus window.
  • Mute window with unfocus and focus events.
  • Zooming.
  • Add multi-monitor support.
  • Share audio between windows.
  • Make switching between main and sub stream more seamless.

Documentation

Overview

Copyright © 2022 ItsNotGoodName

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
xcursor forked from https://github.com/BurntSushi/xgbutil/blob/master/xcursor/xcursor.go
xcursor forked from https://github.com/BurntSushi/xgbutil/blob/master/xcursor/xcursor.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL