Coder Social home page Coder Social logo

odensc / yatpack Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 2.0 614 KB

Livestreaming with NVIDIA Jetson Nano

License: GNU General Public License v2.0

JavaScript 60.83% HTML 5.18% Shell 1.44% CSS 3.41% Dockerfile 8.88% Svelte 20.27%
jetson nano stream livestream twitch irl gstreamer srt obs

yatpack's Introduction

YATpack

Code and resources for IRL streaming with the NVIDIA Jetson Nano.

Random tech details

  • HEVC video encode + Opus audio
  • Dockerized Jetson client component:
    • Web UI for starting/stopping stream, statistics, configuring settings
    • PWA, so you can add it to your home screen for easy access
  • Dockerized server component:
    • Runs srt-live-server with sane config
    • Runs Node.js watchdog server that can swap between scenes on low bitrate using obs-websocket

Setup

Hardware

You'll want:

  • a Jetson Nano 2GB developer kit
  • a UVC capture card compatible with Linux/V4L2, capable of at least 1080p30 uncompressed @ YUV 4:2:2
    • I'm currently using a Cam Link 4K, but other cards should work if you can change the GStreamer pipeline accordingly.
  • a camera! With HDMI output for the capture card.
  • a high quality USB-C power bank that supports 5v @ 3A
    • I'm currently using this one. You should look at the spec sheet / manual to confirm max current.
  • USB-C cable
  • USB WiFi adapter, or cable for phone to USB tether
  • MicroSD card with Jetson image flashed, at least 32GB

Software

Both the client and server are distributed as Docker images. The client runs on your Nano, and the server runs on your PC/VPS.

1. Client

The Jetson Nano SD card image should come with Docker pre-installed, so simply run the below commands on your Nano. (you'll want to change SRT_IP to your server)

sudo systemctl enable --now docker
sudo docker run --restart always --name yatpack-client \
  --ipc=host --runtime nvidia \
  --device /dev/snd --device /dev/video0 -p 80:80 -e PORT=80 \
  -e SRT_IP=my.server.com:1935 \
  odensc/yatpack-client

The web UI should then be accessible at the IP of your Nano.

2. Server

The server component is technically optional but strongly recommended, as it provides an SRT server and auto scene swapping via obs-websocket. If you don't use it, you'll need to set up your own SRT server (at least).

You'll need a Linux server with Docker installed. You can also use Windows w/ Docker Desktop but will need to run the commands via WSL2.

Run the below commands:

sudo systemctl enable --now docker
sudo docker run --restart always --name yatpack-server -p 1935:1935/udp \
  -e OBS_ADDRESS=10.0.0.2:4444 -e OBS_PASSWORD=hunter2 \
  -e SCENE_NAME_CONNECTED=Connected -e SCENE_NAME_DISCONNECTED=Disconnected \
  odensc/yatpack-server

Edit the above environment variables accordingly to match your OBS setup (below).

3. OBS Machine

You should install obs-websocket and configure it to require a password.

Make a new scene called Connected and create a Media Source. This scene will show whilst the stream is on.

For the input URL, use srt://my.server.com:1935?streamid=output/live/pack (replacing the IP), set Network Buffering to the minimum value, and enable hardware decoding.

Make a new scene called Disconnected and put whatever graphics you want in it. This scene will show when the bitrate is too low for coherent video, or when the stream completely drops.

Stream!

yatpack's People

Contributors

odensc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

edinsof kruger-os

yatpack's Issues

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.