Compare commits
6 commits
transcoder
...
main
Author | SHA1 | Date | |
---|---|---|---|
11b0c4dd6e | |||
b2760dcb78 | |||
970b6366a7 | |||
d0c3bffd3b | |||
6274e7a679 | |||
6fa6482162 |
3 changed files with 27 additions and 5 deletions
|
@ -8,6 +8,8 @@ Uses the std lib http server implementation for the http serving side.
|
||||||
|
|
||||||
**Not intended for actual use**. The stream key use is not secure and is used to handle directories without a user db system, than to provide auth. Same goes for the SRT passphrase. Also just accepts connections so will get DDOS'd immediately.
|
**Not intended for actual use**. The stream key use is not secure and is used to handle directories without a user db system, than to provide auth. Same goes for the SRT passphrase. Also just accepts connections so will get DDOS'd immediately.
|
||||||
|
|
||||||
|
**Update**: main branch has been tested over a network. RTMP should now work fine, SRT "works" with a few modifications. The RTT ping log-buffer slice must be extended depending on network latency (try ~2x latency/10ms, could adjust automatically, but eh). Also will inevitably crash on poor connections due to the lack of DROPSEQ handling, but will work perfectly fine during the initial 3-10s you get.
|
||||||
|
|
||||||
Limits to a single stream at a time, mostly for the lack of db to handle connections and user information rather than concurrency problems.
|
Limits to a single stream at a time, mostly for the lack of db to handle connections and user information rather than concurrency problems.
|
||||||
|
|
||||||
Currently always transcodes to vp9 + opus, segments to fragmented mp4. Creates one segment playlist, no manifest. Uses ffmpeg
|
Currently always transcodes to vp9 + opus, segments to fragmented mp4. Creates one segment playlist, no manifest. Uses ffmpeg
|
||||||
|
|
|
@ -147,7 +147,12 @@ func (agent *SRTManager) process_conclusion(packet *Packet) (*Packet) {
|
||||||
resp_packet := agent.create_conclusion_resp()
|
resp_packet := agent.create_conclusion_resp()
|
||||||
if packet.packet_type == HANDSHAKE {
|
if packet.packet_type == HANDSHAKE {
|
||||||
hs_cif := packet.cif.(*HandshakeCIF)
|
hs_cif := packet.cif.(*HandshakeCIF)
|
||||||
if hs_cif.hs_type == 0xffffffff && hs_cif.syn_cookie == agent.syn_cookie {
|
|
||||||
|
// allow previous shotgunned induction requests to dissipate
|
||||||
|
if hs_cif.hs_type != 0xffffffff {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if hs_cif.syn_cookie == agent.syn_cookie {
|
||||||
for _, v := range hs_cif.hs_extensions {
|
for _, v := range hs_cif.hs_extensions {
|
||||||
// force client to add a stream_id for output location
|
// force client to add a stream_id for output location
|
||||||
// to do: add encryption handling
|
// to do: add encryption handling
|
||||||
|
|
|
@ -8,11 +8,26 @@ import (
|
||||||
|
|
||||||
func NewTranscoder(stream_key string) (io.WriteCloser, error) {
|
func NewTranscoder(stream_key string) (io.WriteCloser, error) {
|
||||||
base_dir, _ := os.UserHomeDir()
|
base_dir, _ := os.UserHomeDir()
|
||||||
command := "hls-transcoder-2"
|
command := "ffmpeg"
|
||||||
command_args := []string{
|
command_args := []string{
|
||||||
"4",
|
"-probesize", "500",
|
||||||
"/vid/" + stream_key + "/",
|
"-i", "pipe:0",
|
||||||
"4",
|
"-c:a", "libopus",
|
||||||
|
"-c:v", "vp9",
|
||||||
|
"-quality", "realtime",
|
||||||
|
"-speed", "7",
|
||||||
|
"-tile-columns", "4",
|
||||||
|
"-frame-parallel", "1",
|
||||||
|
"-threads", "8",
|
||||||
|
"-b:v", "1M",
|
||||||
|
"-g", "30",
|
||||||
|
"-hls_time", "6",
|
||||||
|
"-hls_list_size", "4",
|
||||||
|
"-hls_base_url", "/vid/" + stream_key + "/",
|
||||||
|
"-hls_segment_type", "fmp4",
|
||||||
|
"-hls_flags", "delete_segments",
|
||||||
|
"-hls_flags", "+program_date_time",
|
||||||
|
"stream.m3u8",
|
||||||
}
|
}
|
||||||
transcoder := exec.Command(command, command_args...)
|
transcoder := exec.Command(command, command_args...)
|
||||||
transcoder.Dir = base_dir + "/live/" + stream_key + "/"
|
transcoder.Dir = base_dir + "/live/" + stream_key + "/"
|
||||||
|
|
Loading…
Reference in a new issue