Internet stream m3u8 how to supply referer?
#1
I have a Kodi system running on Raspberry Pi3. It is used to show video files in mp4 format.
The files are stored in a directory tree on a 1TB hard drive and they change as time passes (downloaded news shows mainly).
So I am not using any library function, just the mp4 video files.

But I also want to be able to play video url's in real time on the Kodi system so I have added a streams dir where I have text files with extension .strm containing the stream url.
These url's are the same as I use for downloading with ffmpeg when the shows are saved for later viewing.

It turns out that for 2 of my video sources the m3u8 URL is all that is needed in the strm file for Kodi to play the stream in real time.
But the other sources, which work fine via ffmpeg, do not play at all on Kodi - an error message is shown only.

In my download scripts using ffmpeg I have used the following to get around this (-referer or -user_agent arguments):
 
Code:
CMD="ffmpeg -hide_banner -referer \"${VIDEOURL}\" -i \"${VIDEOSTR}\" -vf scale=w=-4:h=480 -c:v libx264 -preset fast -crf 26 -c:a copy -t ${CAPTURETIME} ${TARGETFILE}"
or this:
CMD="ffmpeg -hide_banner -user_agent \"Mozilla\" -i $VIDEOSTR -vf scale=w=-4:h=360 -c:v libx264 -preset fast -crf 26 -c:a copy -t $CAPTURETIME $TARGETFILE"
VIDEOURL is the webpage on which the embedded video player resides
VIDEOSTR is the actual stream URL in m3u8 format

So my questions is are:
Can I somehow add an extra argument inside the strm file to make Kodi understand what to send to the source site as referer?
If so how is it done?
Or is there some other way to accomplish it?
Bo Berglund
Sweden
Reply
#2
I think I posted my question in the wrong sub-forum, can you please help me?
This is my original post: Internet stream - how to supply referer
My problem is that Kodi will not play the stream but ffmpeg can happily download it if the -referer argument is supplied in the command.
How can I do this in Kodi?
All details is in the thread I linked to.
Bo Berglund
Sweden
Reply
#3
Have a read over https://kodi.wiki/view/HTTP

You can supply headers after a | in the url. Eg: http://myfantasticvideostream.m3u8|Referer=x
Reply
#4
@Bosse_B - Threads merged and placed in the Linux forum.

If that is the wrong place please let us know specifically where it should go.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#5
(2022-01-09, 12:49)enen92 Wrote: Have a read over https://kodi.wiki/view/HTTP
No I have been directed to another page before concerning strm file formats and there was no mention of this page there...
Quote:You can supply headers after a | in the url. Eg: http://myfantasticvideostream.m3u8|Referer=x
Thanks for this!
This is exactly what I need to make the strm file actually play!
Worked the first time around! Smile

Now I only have to understand why the strm file changes name in the file listing view inside Kodi...
I have stored it as a file named "Something_or_other.strm" and when I initially navigate into the folder this name is listed but when I navigate among the strm files the display changes to something completely unusable like "mono.m3u8" which is the ending part of the url.
Since all of these strm files contain similar url entries it becomes impossible to navigate to the correct item.
I have looked in the settings and the item to replace a file name by the video content name is INACTIVE but still this happens and it is not even the content but just the end of the url...

I am running the latest version of OSMC on a RaspberryPi3 device if that matters.
Bo Berglund
Sweden
Reply

Logout Mark Read Team Forum Stats Members Help
Internet stream m3u8 how to supply referer?0