#6548·streamlink

Allow specifying Content-Type headers for HTTP streams

Author: LenseCreated Jun 4, 2025Updated Jun 4, 2025
Labelsfeature requestCLI

Checklist

Collaboration

Description

Use case: I use streamlink to play videos on my TV by creating an HTTP server with --player-external-http and then sending a UPnP message to the TV telling it to render the stream. This does not work out of the box because the TV rejects HTTP servers with Content-Type headers that it doesn't support.

I have gotten streams I care about to work with my TV by hard-coding video/mp4:

--- src/streamlink_cli/output/http.py
+++ src/streamlink_cli/output/http.py
@@ -90,7 +90,7 @@ class HTTPOutput(Output):
         try:
             conn.send(b"HTTP/1.1 200 OK\r\n")
             conn.send(b"Server: Streamlink\r\n")
-            conn.send(b"Content-Type: video/unknown\r\n")
+            conn.send(b"Content-Type: video/mp4\r\n")
             conn.send(b"\r\n")
         except OSError as err:
             raise OSError("Failed to write data to socket") from err

But obviously that's not a general solution.

It would be great to have a CLI option to set the Content-Type.