User agent not being passed to ffmpeg
#1
I have a m3u link that needs a specific user agent to run.
I added the user agent at the end of the stream link like so
Quote:stream link|user-agent=myuseragent
This works.. As i get a 200 success status code (I used to get 403 unauthorized without the user agent before)

But what happens is that this stream link gets the stream chunks from another host that also needs the same user agent.
This is handled by ffmpeg(I think. SInce the error log showed [ffmpeg] prefix).

Kodi is not passing the user agent to ffmpeg which is where I am getting a 403 unauthorized status code again. (got this info from the log)

Is there any way I can fix the issue?

I looked into the source code of kodi and found out there is a file which sets headers for ffmpeg.

Any help would be appreciated.

I am using OSMC on RPi 3b+
Reply
#2
I am using PVR Simple IPTV plugin.
Reply
#3
The problem is here: https://github.com/xbmc/xbmc/blob/master...#L246-L250

That code path is not being used when playing HTTP URLs  through PVR IPTV Simple addon so the User-Agent and other HTTP headers are not passed down to ffmpeg (cURL uses them when making a request to check for media type). It is used when you playback your URL as a ".strm" file or playback your m3u playlist outside of PVR addon. You can easily confirm that fact: add you playlist (or .strm file with single link) to Kodi's playlist folder and them play it.. it should work.


No idea what stream type value is set by official version od PVR IPTV Simple addon but it clearly isn't "DVDSTREAM_TYPE_FFMPEG". I'm using a Kodi fork together with a PVR IPTV Simple fork both originally made by CoreELEC devs to enable "archive/cutv/ server based timeshift" functionality and when in PVR addon settings you enable "archive" functionality the stream type gets set as "DVDSTREAM_TYPE_PVR_ARCHIVE" (that doesn't exist in official Kodi code base!) so I've also made changes to that code blocked linked at the above URL to make it forward HTTP headers to ffmpeg. And now headers are being forwarded when using PVR addon.
Reply
#4
Can you give link example link that doesn’t work?

If it’s an m3u8 file it should be handled by the ffmpeg input stream. If it’s not being handled correctly there is something different about the link.
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#5
i dont want to necrro but for future reerence, i can confirm that with iptvsimple client ver 3.9.8, with kodi ver 18.9,  header parameteres are are ignored by ffmpeg but taken into consideration in libbcurl. see below log:

Code:
2020-10-27 23:37:49.177 T:139727801923328    INFO: ffmpeg[7F14E9FFB700]: [hls,applehttp] Opening 'https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1603859868/ei/PKGYX7H1J8qzgAeZ5r7YCQ/ip/188.194.212.160/id/deKH0pQ7-rg.1/itag/96/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D137/hls_chunk_host/r1---sn-h0jeenek.googlevideo.com/playlist_duration/30/manifest_duration/30/vprv/1/playlist_type/DVR/mh/Gz/mm/44/mn/sn-h0jeenek/ms/lva/mv/u/mvi/1/pl/24/dover/11/keepalive/yes/beids/23886215/mt/1603837762/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,live,goi,sgoap,sgovp,playlist_duration,manifest_duration,vprv,playlist_type/sig/AOq0QJ8wRQIgBE_JQph58j4KKWzim9UgY-eLppuIS4FniI7Zp1ESATACIQCBkMJP5urNTqZOxjx2UubVoZV_vJ-W8rmECOpRysVpWA%3D%3D/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl/lsig/AG3C_xAwRQIhAMTMh1bHfCrBGQo2TruGirigWeAaJ65ixFe2Tw-dWulpAiBJoP70yvX8Lnjo8oYUl4CjN0uUVVVgUOa66rNu3Qrs5w%3D%3D/playlist/index.m3u8|User-Agent=Mozilla%2F5.0+%28X11%3B+Ubuntu%3B+Linux+x86_64%3B+rv%3A78.0%29+Gecko%2F20100101+Firefox%2F78.0' for reading
2020-10-27 23:37:49.177 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
2020-10-27 23:37:49.244 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] request: GET /api/manifest/hls_playlist/expire/1603859868/ei/PKGYX7H1J8qzgAeZ5r7YCQ/ip/188.194.212.160/id/deKH0pQ7-rg.1/itag/96/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D137/hls_chunk_host/r1---sn-h0jeenek.googlevideo.com/playlist_duration/30/manifest_duration/30/vprv/1/playlist_type/DVR/mh/Gz/mm/44/mn/sn-h0jeenek/ms/lva/mv/u/mvi/1/pl/24/dover/11/keepalive/yes/beids/23886215/mt/1603837762/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,live,goi,sgoap,sgovp,playlist_duration,manifest_duration,vprv,playlist_type/sig/AOq0QJ8wRQIgBE_JQph58j4KKWzim9UgY-eLppuIS4FniI7Zp1ESATACIQCBkMJP5urNTqZOxjx2UubVoZV_vJ-W8rmECOpRysVpWA%3D%3D/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl/lsig/AG3C_xAwRQIhAMTMh1bHfCrBGQo2TruGirigWeAaJ65ixFe2Tw-dWulpAiBJoP70yvX8Lnjo8oYUl4CjN0uUVVVgUOa66rNu3Qrs5w%3D%3D/playlist/index.m3u8|User-Agent=Mozilla%2F5.0+%28X11%3B+Ubuntu%3B+Linux+x86_64%3B+rv%3A78.0%29+Gecko%2F20100101+Firefox%2F78.0 HTTP/1.1
2020-10-27 23:37:49.244 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] User-Agent: Lavf/58.12.100
2020-10-27 23:37:49.244 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] Accept: */*
2020-10-27 23:37:49.244 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] Connection: keep-alive
2020-10-27 23:37:49.244 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] Host: manifest.googlevideo.com
2020-10-27 23:37:49.244 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] Icy-MetaData: 1
2020-10-27 23:37:49.244 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https]
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='HTTP/1.1 200 OK'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] http_code=200
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='Content-Type: application/vnd.apple.mpegurl'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='Date: Tue, 27 Oct 2020 22:37:49 GMT'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='Pragma: no-cache'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='Expires: Fri, 01 Jan 1990 00:00:00 GMT'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='Cache-Control: no-cache, must-revalidate'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='Server: HTTP server (unknown)'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='Content-Length: 7039'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='X-XSS-Protection: 0'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='X-Frame-Options: SAMEORIGIN'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header='Alt-Svc: h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"'
2020-10-27 23:37:49.360 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [https] header=''

2020-10-27 23:37:49.361 T:139727801923328   DEBUG: ffmpeg[7F14E9FFB700]: [hls,applehttp] new_program: id=0x0000

Reply

Logout Mark Read Team Forum Stats Members Help
User agent not being passed to ffmpeg0