Allow specifying Content-Type headers for HTTP streams
Author: LenseCreated Jun 4, 2025Updated Jun 4, 2025
Labelsfeature requestCLI
Checklist
- This is a feature request and not a different kind of issue
- I have read the contribution guidelines
- I have checked the list of open and recently closed feature requests
Collaboration
- My request is genuine and in the best interest of the project
- I will provide feedback should a pull request be opened with a new feature implementation
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 errBut obviously that's not a general solution.
It would be great to have a CLI option to set the Content-Type.
Source: streamlink/streamlink