diff --git a/src/media/newApi.ts b/src/media/newApi.ts
index original..modified 100644
--- a/src/media/newApi.ts
+++ b/src/media/newApi.ts
@@ -261,12 +261,10 @@ export function prepareStream(
   if (isHttpUrl) {
-    command.inputOptions(
-      "-headers",
-      Object.entries(customHeaders)
-        .map(([k, v]) => `${k}: ${v}`)
-        .join("\r\n"),
-    );
+    const headersString = Object.entries(customHeaders)
+      .map(([k, v]) => `${k}: ${v}`)
+      .join("\r\n");
+    command.inputOptions(`-headers "${headersString}"`);
     if (!isHls) {
       command.inputOptions([
         "-reconnect 1",
