Skip to content

Commit

Permalink
fixed no audio and subs on downloaded video
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirari04 committed Jan 18, 2024
1 parent 2b49789 commit 379dd3a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions controllers/DownloadVideoController.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ func DownloadVideoController(c echo.Context) error {
return c.String(http.StatusBadRequest, "video doesn't exist")
}
files := []string{}

streamIndex := 0
// add video
for _, quality := range dbLink.File.Qualitys {
if quality.Name == requestValidation.QUALITY {
files = append(files, "-i", fmt.Sprintf(
"%s/%s",
quality.Path,
quality.OutputFile,
))
), "-map", fmt.Sprint(streamIndex))
streamIndex++
}
}

Expand All @@ -63,7 +64,8 @@ func DownloadVideoController(c echo.Context) error {
"%s/%s",
audio.Path,
audio.OutputFile,
))
), "-map", fmt.Sprint(streamIndex))
streamIndex++
}

// add subtitles
Expand All @@ -72,10 +74,11 @@ func DownloadVideoController(c echo.Context) error {
"%s/%s",
subtitle.Path,
subtitle.OutputFile,
))
), "-map", fmt.Sprint(streamIndex))
streamIndex++
}

cmdString := append(files, []string{"-map", "0", "-c", "copy", "-f", "matroska", "pipe:1"}...)
cmdString := append(files, []string{"-c", "copy", "-f", "matroska", "pipe:1"}...)

cmd := exec.Command("ffmpeg", cmdString...)
pipe, err := cmd.StdoutPipe()
Expand Down

0 comments on commit 379dd3a

Please sign in to comment.