Giter VIP home page Giter VIP logo

freenas-jail-with-webcam's Introduction

freeNAS-Jail-with-webcam

This is a howto for installing a webcam streamer on a freeNAS system where streaming happens inside a jail. I use this to stream video to an octoprint instance.

Architecture

Usually, everything should be installed and modified only inside a FreeNAS jail. However, the base FreeNAS os has per default no webcam drivers. The root modifications do not survive a reboot, but work for me.

root:

This enables usage of pkg on root. Decide wheter to do this on your own.

sed 's/enabled: yes/enabled: no/' /usr/local/etc/pkg/repos/local.conf
sed 's/enabled: no/enabled: yes/' /usr/local/etc/pkg/repos/FreeBSD.conf
pkg update

Install webcam drivers:

pkg install webcamd
pkg install cuse4bsd-kmod
kldload cuse4bsd       #todo: somehow survive restart.

echo webcamd_0_flags="-N Image-Processor-USB-2-0-PC-Cam" >> rc.conf # or however your camera is called
echo webcamd_enable="YES" >> rc.conf

(maybe fiddle around with startup-script /etc/local/rc.d/webcamd to force user to root)

service webcamd start
ls /dev/video* #should return new devices...

jail:

pkg install ustreamer

octoprint# cat printerctl.sh

#!/usr/local/bin/bash

if [ $# -ne 1 ]; then
        echo "usage: $0 <start|stop>"
        exit 1
fi
if [ "$1" = "start" ]; then
        mosquitto_pub -h 192.168.0.8 -t espRelais/switch -m 1
        /root/uhubctl/uhubctl -p 2 -a on        #camera
        /root/uhubctl/uhubctl -p 5 -a on        #printer
        /root/ustreamer.sh start
elif [ "$1" = "stop" ]; then
        /root/uhubctl/uhubctl -p 5 -a off       #printer
        mosquitto_pub -h 192.168.0.8 -t espRelais/switch -m 0
        /root/ustreamer.sh stop
fi

octoprint# cat ustreamer.sh

#!/usr/local/bin/bash
#ustreamer -s 0.0.0.0 --brightness-auto --quality 98 --desired-fps 15 --resolution 1280x1024

if [ $# -ne 1 ]; then
        echo "usage: $0 <start|stop>"
        exit 1
fi
if [ "$1" = "start" ]; then
        nohup ustreamer -s 0.0.0.0 --quality 98  --brightness-auto --desired-fps 15 > /var/log/ustreamer.log 2>&1 &
elif [ "$1" = "stop" ]; then
        killall ustreamer
fi

freenas-jail-with-webcam's People

Contributors

cirromulus avatar

Watchers

 avatar  avatar

freenas-jail-with-webcam's Issues

TrueNAS kernel alternatives

I currently have octoprint running in a jail on TrueNAS but the webcam part has proven to be a nightmare, a lot in part because I'm fairly new to NAS and that sort of thing in general.

I'm trying to run the first part

pkg install webcamd
pkg install cuse4bsd-kmod
kldload cuse4bsd #todo: somehow survive restart.

echo webcamd_0_flags="-N Image-Processor-USB-2-0-PC-Cam" >> rc.conf
echo webcamd_enable="YES" >> rc.conf

but my shell is complaining

image

and also I'm a bit afraid to modify my kernel because I have some photos and other important things on the NAS.
Do you have any idea how to do this with TrueNAS or any alternative where I don't have to modify the kernel?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.