video-streaminghttp-live-streamingtransport-stream

Can I use TSDuck's tsp tool for HLS with token-based authentication?


I have developed a TSDuck plugin which I use within the tsp tool to extract data from specific packets. Up till now I've always used this directly on an SRT stream, but I now have a use case to apply the same process to an HLS stream with a bespoke token-based authentication.

In ffmpeg, I can access the video via:

ffmpeg -headers x-affiliate-auth-key:{token} -i https://{url}/index.m3u8

However, I do not see any equivalent option to -headers to use within tsp, so as you would expect this fails (because tsp will receive an HTTP error message, not an HLS manifest):

tsp -I hls https://{url}/index.m3u8 -O file /tmp/test.mp4
* Error: hls: invalid HLS playlist, does not start with #EXTM3U

Is there any way to pass custom headers through tsp for HLS input?

Thanks in advance for your help.


Solution

  • A recent code contribution added options --headers to the TSDuck hls input plugin. Will be included in version 3.36 (about to be released) or recent nightly builds.