mirror of
https://github.com/owncast/owncast.git
synced 2024-11-21 12:18:02 +03:00
Create pipe in tmp directory instead of cwd
This commit is contained in:
parent
161aaeec8d
commit
d0ec846b30
4 changed files with 12 additions and 6 deletions
|
@ -20,8 +20,9 @@ func startFfmpeg(configuration Config) {
|
|||
}
|
||||
|
||||
log.Printf("Starting transcoder saving to /%s.", outputDir)
|
||||
pipePath := getTempPipePath()
|
||||
|
||||
ffmpegCmd := "cat streampipe.flv | " + configuration.FFMpegPath +
|
||||
ffmpegCmd := "cat " + pipePath + " | " + configuration.FFMpegPath +
|
||||
" -hide_banner -i pipe: -vf scale=" + strconv.Itoa(configuration.VideoSettings.ResolutionWidth) + ":-2 -g 48 -keyint_min 48 -preset ultrafast -f hls -hls_list_size 30 -hls_time " +
|
||||
strconv.Itoa(configuration.VideoSettings.ChunkLengthInSeconds) + " -strftime 1 -use_localtime 1 -hls_segment_filename '" +
|
||||
outputDir + "/stream-%Y%m%d-%s.ts' -hls_flags delete_segments -segment_wrap 100 " + hlsPlaylistName
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
@ -52,10 +51,9 @@ func (h *Handler) OnPublish(timestamp uint32, cmd *rtmpmsg.NetStreamPublish) err
|
|||
return errors.New("PublishingName is empty")
|
||||
}
|
||||
|
||||
// Record streams as FLV!
|
||||
p := filepath.Join(
|
||||
filepath.Clean(filepath.Join("./", fmt.Sprintf("%s.flv", "streampipe"))),
|
||||
)
|
||||
// Record streams as FLV
|
||||
p := getTempPipePath()
|
||||
fmt.Println(p)
|
||||
syscall.Mkfifo(p, 0666)
|
||||
f, err := os.OpenFile(p, os.O_RDWR, os.ModeNamedPipe)
|
||||
if err != nil {
|
||||
|
|
2
main.go
2
main.go
|
@ -50,5 +50,7 @@ func startChatServer() {
|
|||
// static files
|
||||
http.Handle("/", http.FileServer(http.Dir("webroot")))
|
||||
|
||||
log.Printf("Starting public web server on port %d", configuration.WebServerPort)
|
||||
|
||||
log.Fatal(http.ListenAndServe(":"+strconv.Itoa(configuration.WebServerPort), nil))
|
||||
}
|
||||
|
|
5
utils.go
5
utils.go
|
@ -5,6 +5,7 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -30,6 +31,10 @@ func touch(fileName string) {
|
|||
}
|
||||
}
|
||||
|
||||
func getTempPipePath() string {
|
||||
return filepath.Join(os.TempDir(), "streampipe.flv")
|
||||
}
|
||||
|
||||
func copy(src, dst string) {
|
||||
input, err := ioutil.ReadFile(src)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue