From b4e505f1b47fd72d53bf6173fc55eb21cd6494ac Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 7 Jan 2024 22:48:24 +0800 Subject: [PATCH] VLive: Fix rebuild URL bug. v5.12.20 --- DEVELOPER.md | 1 + platform/virtual-live-stream.go | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/DEVELOPER.md b/DEVELOPER.md index eb0d4e53..031f7a9d 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -1078,6 +1078,7 @@ The following are the update records for the SRS Stack server. * Transcript: Check the base url for OpenAI. [v5.12.17](https://github.com/ossrs/srs-stack/releases/tag/v5.12.17) * HLS: Support low latency mode about 5s. v5.12.18 * RTSP: Rebuild the URL with escaped user info. v5.12.19 + * VLive: Fix rebuild URL bug. [v5.12.20](https://github.com/ossrs/srs-stack/releases/tag/v5.12.20) * v5.11 * VLive: Decrease the latency for virtual live. v5.11.1 * Live: Refine multiple language. v5.11.2 diff --git a/platform/virtual-live-stream.go b/platform/virtual-live-stream.go index 0656a374..10d05e58 100644 --- a/platform/virtual-live-stream.go +++ b/platform/virtual-live-stream.go @@ -545,10 +545,14 @@ func (v *VLiveWorker) Handle(ctx context.Context, handler *http.ServeMux) error args = append(args, "-rtsp_transport", "tcp") } // Rebuild the stream url, because it may contain special characters. - if u, err := RebuildStreamURL(file.Target); err != nil { - return errors.Wrapf(err, "rebuild %v", file.Target) + if strings.Contains(file.Target, "://") { + if u, err := RebuildStreamURL(file.Target); err != nil { + return errors.Wrapf(err, "rebuild %v", file.Target) + } else { + args = append(args, "-i", u.String()) + } } else { - args = append(args, "-i", u.String()) + args = append(args, "-i", file.Target) } stdout, err := exec.CommandContext(toCtx, "ffprobe", args...).Output() @@ -1084,10 +1088,14 @@ func (v *VLiveTask) doVLive(ctx context.Context, input *VLiveSourceFile) error { args = append(args, "-rtsp_transport", "tcp") } // Rebuild the stream url, because it may contain special characters. - if u, err := RebuildStreamURL(input.Target); err != nil { - return errors.Wrapf(err, "rebuild %v", input.Target) + if strings.Contains(input.Target, "://") { + if u, err := RebuildStreamURL(input.Target); err != nil { + return errors.Wrapf(err, "rebuild %v", input.Target) + } else { + args = append(args, "-i", u.String()) + } } else { - args = append(args, "-i", u.String()) + args = append(args, "-i", input.Target) } args = append(args, "-c", "copy", "-f", "flv", outputURL) cmd := exec.CommandContext(ctx, "ffmpeg", args...)