Skip to content

Commit

Permalink
Reactivate the VLC option
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelGoerentz committed Nov 24, 2024
1 parent 0184ef5 commit e1b06f1
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 35 deletions.
3 changes: 2 additions & 1 deletion html/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,10 @@
},
"streamBuffering": {
"title": "Stream Buffer",
"description": "Functions of the buffer:<br>- The stream is passed from FFmpeg or Threadfin to Plex, Emby, Jellyfin or M3U Player<br>- Small jerking of the streams can be compensated<br>- HLS / M3U8 support<br>- RTP / RTPS support<br>- Re-streaming<br>- Separate tuner limit for each playlist",
"description": "Functions of the buffer:<br>- The stream is passed from FFmpeg, VLC or Threadfin to Plex, Emby, Jellyfin or M3U Player<br>- Small jerking of the streams can be compensated<br>- HLS / M3U8 support<br>- RTP / RTPS support<br>- Re-streaming<br>- Separate tuner limit for each playlist",
"info_false": "No Buffer (Client connects directly to the streaming server)",
"info_ffmpeg": "FFmpeg connects to the streaming server",
"info_vlc": "VLC connects to the streaming server",
"info_threadfin": "Threadfin connects to the streaming server"
},
"udpxy": {
Expand Down
11 changes: 8 additions & 3 deletions src/serveStream.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,16 +276,19 @@ It will use the third party tool defined in the settings and starts a process fo
*/
func CreateAlternativNoMoreStreamsVideo(pathToFile string) error {
cmd := new(exec.Cmd)
arguments := []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)}
vlcArguments := []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}
ffmpegArguments := []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)}
switch Settings.Buffer {
case "ffmpeg":
cmd = exec.Command(Settings.FFmpegPath, arguments...)
cmd = exec.Command(Settings.FFmpegPath, ffmpegArguments...)
case "vlc":
cmd = exec.Command(Settings.VLCPath, vlcArguments...)
default:
if Settings.FFmpegPath != "" {
if _, err := os.Stat(Settings.FFmpegPath); err != nil {
return fmt.Errorf("ffmpeg path is not valid. Can not convert custom image to video")
} else {
cmd = exec.Command(Settings.FFmpegPath, arguments...)
cmd = exec.Command(Settings.FFmpegPath, ffmpegArguments...)
}
} else {
return fmt.Errorf("no ffmpeg path given")
Expand All @@ -302,6 +305,8 @@ func CreateAlternativNoMoreStreamsVideo(pathToFile string) error {
return nil
}

// TODO: Add Function to get third party tool path and arguments

/*
StopStream stops the third party tool process when there are no more clients receiving the stream
*/
Expand Down
67 changes: 39 additions & 28 deletions src/webUI.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion threadfin.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var GitHub = GitHubStruct{Branch: "Main", User: "marcelGoerentz", Repo: "Threadf
const Name = "Threadfin"

// Version : Version, die Build Nummer wird in der main func geparst.
const Version = "1.7.8-beta"
const Version = "1.7.9-beta"

// DBVersion : Datanbank Version
const DBVersion = "0.5.0"
Expand Down
32 changes: 30 additions & 2 deletions ts/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,34 @@ class SettingsCategory {
setting.appendChild(tdRight)
break

case "vlc.path":
var tdLeft = document.createElement("TD")
tdLeft.innerHTML = "{{.settings.vlcPath.title}}" + ":"

var tdRight = document.createElement("TD")
var input = content.createInput("text", "vlc.path", data)
input.setAttribute("placeholder", "{{.settings.vlcPath.placeholder}}")
input.setAttribute("onchange", "javascript: this.className = 'changed'")
tdRight.appendChild(input)

setting.appendChild(tdLeft)
setting.appendChild(tdRight)
break

case "vlc.options":
var tdLeft = document.createElement("TD")
tdLeft.innerHTML = "{{.settings.vlcOptions.title}}" + ":"

var tdRight = document.createElement("TD")
var input = content.createInput("text", "vlc.options", data)
input.setAttribute("placeholder", "{{.settings.vlcOptions.placeholder}}")
input.setAttribute("onchange", "javascript: this.className = 'changed'")
tdRight.appendChild(input)

setting.appendChild(tdLeft)
setting.appendChild(tdRight)
break

case "bindingIPs":
var tdLeft = document.createElement("TD")
tdLeft.innerHTML = "{{.settings.bindingIPs.title}}" + ":"
Expand Down Expand Up @@ -563,8 +591,8 @@ class SettingsCategory {
tdLeft.innerHTML = "{{.settings.streamBuffering.title}}" + ":"

var tdRight = document.createElement("TD")
var text: any[] = ["{{.settings.streamBuffering.info_false}}", "FFmpeg: ({{.settings.streamBuffering.info_ffmpeg}})", "Threadfin: ({{.settings.streamBuffering.info_threadfin}})"]
var values: any[] = ["-", "ffmpeg", "threadfin"]
var text: any[] = ["{{.settings.streamBuffering.info_false}}", "FFmpeg: ({{.settings.streamBuffering.info_ffmpeg}})", "VLC: ({{.settings.streamBuffering.info_vlc}})", "Threadfin: ({{.settings.streamBuffering.info_threadfin}})"]
var values: any[] = ["-", "ffmpeg", "vlc", "threadfin"]

var select = content.createSelect(text, values, data, settingsKey)
select.setAttribute("onchange", "javascript: this.className = 'changed'")
Expand Down

0 comments on commit e1b06f1

Please sign in to comment.