avoid ffmpeg default http headers
#1
Hi all, I'm learning and developing an addon called TVBOX, it's published in github, but I have one problem with a page (until today it was working but I know that it happens :'( ).

I've seen that it's a problem with headers, but it's not like you can append |Referer=blablabla.com, it's because kodi when calls to ffmpeg it appends Icy-MetaData: 1

22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] request: GET /live/cuatro_xrf2a3/playlist.m3u8?st=8If-lp-putG5fQ_PAioD-Q&e=1460073969 HTTP/1.1
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] Range: bytes=0-
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] Host: cdn.sstream.pw
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] Icy-MetaData: 1
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] Accept: text/html,application/xhtml xml,application/xml;q=0.9,*/*;q=0.8
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] Accept-Charset: UTF-8,*;q=0.8
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] Accept-Language: en-US,en;q=0.8,es-ES;q=0.5,es;q=0.3
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] Connection: keep-alive
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] DNT: 1
22:03:06 T:139807962167040 DEBUG: ffmpeg[7F2793EBF700]: [http] Referer: http://www.ponlatv.com/jwplayer6/jwplayer.flash.swf

My question is, how the addon can call to player (at the moment it tries to play):

http://cdn.sstream.pw/live/cuatro_xrf2a3...=0.8&DNT=1

or without headers:

http://cdn.sstream.pw/live/cuatro_xrf2a3...1460073969

and don't get in the http request (Icy-MetaData: 1 or Range: bytes=0-).

The call with curl is something like:

curl 'http://cdn.sstream.pw/live/cuatro_xrf2a3/playlist.m3u8?st=8If-lp-putG5fQ_PAioD-Q&e=1460073969' -H 'Host: cdn.sstream.pw' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.8,es-ES;q=0.5,es;q=0.3' -H 'Accept-Encoding: gzip, deflate' -H 'DNT: 1' -H 'Referer: http://www.ponlatv.com/jwplayer6/jwplayer.flash.swf' -H 'Connection: keep-alive'

Thanks in advance, I didn't find anything about this kind of headers in Kodi (only appends other headers with '|')
Reply
#2
Ok, nobody has answer, but it's a real problem.

I've seen why it happens. It's not a Kodi petition, is a default behaviour of ffmpeg:

https://github.com/FFmpeg/FFmpeg/blob/ea...tp.c#L1086

and it's not configurable (probably it's a development forgotten :'( )

I have recompiled ffmpeg disabling that and now it's working fine.

Greetings!
Reply
#3
(2016-04-07, 12:34)bitstuffing Wrote: Ok, nobody has answer, but it's a real problem.

I've seen why it happens. It's not a Kodi petition, is a default behaviour of ffmpeg:

https://github.com/FFmpeg/FFmpeg/blob/ea...tp.c#L1086

and it's not configurable (probably it's a development forgotten :'( )

I have recompiled ffmpeg disabling that and now it's working fine.

Greetings!

Hi, would you please explain how did you solve your issue. I fear I'm in same boat.
Reply
#4
Did you try
Code:
http://host.com/file.m3u8|Referer=www.blah.com&Icy-MetaData=&Connection=keep-alive&.......   ?
I also believe that you need to urlencode the values.
Reply
#5
(2016-09-21, 02:05)learningit Wrote: Did you try
Code:
http://host.com/file.m3u8|Referer=www.blah.com&Icy-MetaData=&Connection=keep-alive&.......   ?
I also believe that you need to urlencode the values.

I guess there is a terminology mix-up in this matter. From Python perspective you need to url-quote header values, not urlencode, that is, to use urllib.quote() function.
Reply
#6
Thanks, the mix-up is bad memory (mine), you are correct urllib.quote().
Reply
#7
1. use http proxy to strip headers (privoxy)
2. write an inputstream plugin to handle the stream (kodi 17), the ffmpeg HLS downloader sucks anyway (no HTTP/1.1/2 keep-alive, no adaptive bitrate ) so this is best long-term solution
3. use a python script to download the stream and serve it to kodi (livestreamer), possibly works on old versions & examples already exist.
Reply

Logout Mark Read Team Forum Stats Members Help
avoid ffmpeg default http headers0