1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-23 01:32:19 +00:00

Reduce verbosity of streaming

This commit is contained in:
Alexandre Iooss 2020-10-05 11:08:22 +02:00
parent 70296e462e
commit cbe6a00d1a
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02

View File

@ -2,7 +2,6 @@ package webrtc
import ( import (
"bufio" "bufio"
"fmt"
"io" "io"
"log" "log"
"net" "net"
@ -43,14 +42,12 @@ func ingestFrom(inputChannel chan srt.Packet) {
} }
}() }()
ffmpeg = exec.Command("ffmpeg", "-re", "-i", "pipe:0", ffmpeg = exec.Command("ffmpeg", "-hide_banner", "-loglevel", "error", "-re", "-i", "pipe:0",
"-an", "-vcodec", "libvpx", //"-cpu-used", "5", "-deadline", "1", "-g", "10", "-error-resilient", "1", "-auto-alt-ref", "1", "-an", "-vcodec", "libvpx", //"-cpu-used", "5", "-deadline", "1", "-g", "10", "-error-resilient", "1", "-auto-alt-ref", "1",
"-f", "rtp", "rtp://127.0.0.1:5004", "-f", "rtp", "rtp://127.0.0.1:5004",
"-vn", "-acodec", "libopus", //"-cpu-used", "5", "-deadline", "1", "-g", "10", "-error-resilient", "1", "-auto-alt-ref", "1", "-vn", "-acodec", "libopus", //"-cpu-used", "5", "-deadline", "1", "-g", "10", "-error-resilient", "1", "-auto-alt-ref", "1",
"-f", "rtp", "rtp://127.0.0.1:5005") "-f", "rtp", "rtp://127.0.0.1:5005")
fmt.Println("Waiting for RTP Packets, please run GStreamer or ffmpeg now")
input, err := ffmpeg.StdinPipe() input, err := ffmpeg.StdinPipe()
if err != nil { if err != nil {
panic(err) panic(err)
@ -77,7 +74,6 @@ func ingestFrom(inputChannel chan srt.Packet) {
if err := packet.Unmarshal(inboundRTPPacket[:n]); err != nil { if err := packet.Unmarshal(inboundRTPPacket[:n]); err != nil {
panic(err) panic(err)
} }
log.Printf("[Video] %s", packet)
// Write RTP packet to all video tracks // Write RTP packet to all video tracks
// Adapt payload and SSRC to match destination // Adapt payload and SSRC to match destination
@ -103,7 +99,9 @@ func ingestFrom(inputChannel chan srt.Packet) {
if err := packet.Unmarshal(inboundRTPPacket[:n]); err != nil { if err := packet.Unmarshal(inboundRTPPacket[:n]); err != nil {
panic(err) panic(err)
} }
log.Printf("[Audio] %s", packet)
// Write RTP packet to all audio tracks
// Adapt payload and SSRC to match destination
for _, audioTrack := range audioTracks { for _, audioTrack := range audioTracks {
packet.Header.PayloadType = audioTrack.PayloadType() packet.Header.PayloadType = audioTrack.PayloadType()
packet.Header.SSRC = audioTrack.SSRC() packet.Header.SSRC = audioTrack.SSRC()