diff --git a/Dockerfile b/Dockerfile index 5f5229f..0d663a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,8 @@ FROM base AS beta RUN go build -tags beta . FROM ${BUILD_FLAG} AS builder -ARG BRANCH -RUN echo "Build ${BRANCH} version" +ARG BUILD_FLAG +RUN echo "Build ${BUILD_FLAG} version" # Second stage. Creating an image # ----------------------------------------------------------------------------- diff --git a/src/buffer.go b/src/buffer.go index 371bffc..0cd4dd1 100644 --- a/src/buffer.go +++ b/src/buffer.go @@ -394,6 +394,7 @@ func (sb *StreamBuffer) writeBytesToPipe(data []byte) error { sb.Stream.ReportError(err, 0, "", true) // TODO: Add error code return err } + time.Sleep(800 * time.Millisecond) } } } \ No newline at end of file diff --git a/src/streamManager.go b/src/streamManager.go index 9b8bba1..3210c6d 100644 --- a/src/streamManager.go +++ b/src/streamManager.go @@ -351,16 +351,14 @@ func GetStreamLimitContent() ([]byte, bool) { createContent := ShouldCreateContent(fileList) if createContent && len(imageFileList) > 0 { err := CreateAlternativNoMoreStreamsVideo(System.Folder.Custom + imageFileList[0].Name()) - if err == nil { - contentOk = true - } else { - ShowError(err, 0) - return nil, false - } - content, err = os.ReadFile(System.Folder.Video + fileList[0].Name()) if err != nil { ShowError(err, 0) } + } + content, err = os.ReadFile(System.Folder.Video + fileList[0].Name()) + if err != nil { + ShowError(err, 0) + } else { contentOk = true } } @@ -474,9 +472,9 @@ func CreateAlternativNoMoreStreamsVideo(pathToFile string) error { func prepareArguments(pathToFile string) (string, []string) { switch Settings.Buffer { case "ffmpeg", "threadfin", "-": - return Settings.FFmpegPath, []string{"--no-audio", "--loop", "--sout", fmt.Sprintf("'#transcode{vcodec=h264,vb=1024,scale=1,width=1920,height=1080,acodec=none,venc=x264{preset=ultrafast}}:standard{access=file,mux=ts,dst=%sstream-limit.ts}'", System.Folder.Video), System.Folder.Video, pathToFile} + return Settings.FFmpegPath, []string{"-loop", "1", "-i", pathToFile, "-c:v", "libx264", "-t", "1", "-pix_fmt", "yuv420p", "-vf", "scale=1920:1080", fmt.Sprintf("%sstream-limit.ts", System.Folder.Video)} case "vlc": - return Settings.VLCPath, []string{"-loop", "1", "-i", pathToFile, "-c:v", "libx264", "-t", "1", "-pix_fmt", "yuv420p", "-vf", "scale=1920:1080", fmt.Sprintf("%sstream-limit.ts", System.Folder.Video)} + return Settings.VLCPath, []string{"--no-audio", "--loop", "--sout", fmt.Sprintf("'#transcode{vcodec=h264,vb=1024,scale=1,width=1920,height=1080,acodec=none,venc=x264{preset=ultrafast}}:standard{access=file,mux=ts,dst=%sstream-limit.ts}'", System.Folder.Video), System.Folder.Video, pathToFile} default: return "", []string{} }