Add instructions

このコミットが含まれているのは:
n9k 2022-03-08 03:38:23 +00:00
コミット a1b1147140
3個のファイルの変更110行の追加1行の削除

ファイルの表示

@ -11,6 +11,59 @@ These mirrors also exist:
* <https://gitlab.com/ninya9k/anonstream>
* <https://github.com/ninya9k/anonstream>
## Setup
You must have Python 3.10 at a minimum.
Clone the repo:
```sh
git clone https://git.076.ne.jp/ninya9k/anonstream.git
cd anonstream
```
Install dependencies in a virtual environment:
```sh
python -m venv venv
source venv/bin/activate
python -m pip install -r requirements.txt
```
Before you run it might want to edit [/config.toml][config]:
* `secret_key`:
used for cryptography, make it any long random string
(e.g. `$ dd if=/dev/urandom bs=16 count=1 | base64`)
* `segments/directory`:
directory containing stream segments, the default is `stream/` in
the project root
* `title/file`:
location of the stream title, the default is `title.txt` in the
project root
* `captcha/fonts`:
locations of fonts for the captcha, leaving it blank will use the
default font
Run it:
```sh
python -m uvicorn app:app --port 5051
```
This will start a webserver listening on localhost port 5051.
If you go to `http://localhost:5051` in a regular web browser now
you should see the interface. When you started the webserver some
credentials were printed in the terminal; you can log in with those at
`http://localhost:5051/login` (requires cookies).
The only things left are (1) streaming, and (2) letting other people
access your stream. [/STREAMING.md][streaming] has instructions for
setting up OBS Studio and a Tor onion service. The instructions will
be useful even if you want to use different streaming software and put
your stream on the Internet some other way.
## Copying
anonstream is AGPL 3.0 or later, see

56
STREAMING.md ノーマルファイル
ファイルの表示

@ -0,0 +1,56 @@
### Tor
Install tor and include these lines in your [torrc][torrc]:
```
HiddenServiceDir $PROJECT_ROOT/hidden_service
HiddenServicePort 80 127.0.0.1:5051
```
but replace `$PROJECT_ROOT` with the folder you cloned the git repo
into.
Then reload tor. If everything went well, the directory will have been
created and your onion address will be in
`$PROJECT_ROOT/hidden_service/hostname`.
### OBS Studio
Install OBS Studio. If the autoconfiguration wizard prompts you to
choose a third-party service, ignore it since we're not gonna be doing
that.
Click `Settings` and set these:
* Advanced
* Recording
* Filename Formatting: `stream`
* Video
* Output (Scaled) Resolution: `960x540` or lower
* Output
* Output Mode: `Advanced`
* Recording:
| | |
|----------------------------|------------------------------------------------------------------------------------------------|
| Type | `Custom Output (FFmpeg)` |
| FFmpeg Output Type | `Output to File` |
| File path or URL | same as config.toml: `segments/directory` (but should be an absolute path) |
| Container Format | `hls` |
| Muxer Settings (if any) | `hls_init_time=0 hls_time=2 hls_list_size=120 hls_flags=delete_segments hls_segment_type=fmp4` |
| Video bitrate | `420 Kbps` or lower |
| Keyframe interval (frames) | `30` (same as the framerate, or exactly half) |
| Video Encoder | libx264, or an H.264 hardware encoder (e.g. `h264_nvenc` for Nvidia, [see here][ffmpeg]) |
| Audio Bitrate | `96 Kbps` |
| Audio Encoder | `aac` |
Then click `OK`.
That's it. To start streaming click `Start Recording`.
Because of the muxer settings we used, segments older than four
minutes will be constantly deleted. When you stop streaming, the last
four minutes worth of segments will remain the segments directory.
You can delete them if you want. When you're not streaming you can
delete everything in the segments directory and it'll be fine.
[torrc]: https://support.torproject.org/#tbb-editing-torrc
[ffmpeg]: https://trac.ffmpeg.org/wiki/HWAccelIntro

ファイルの表示

@ -1,4 +1,4 @@
secret_key = "test"
secret_key = "place secret key here"
[auth]
username = "broadcaster"