Page 1 of 1

Reading m3u8 files containing special characters

Posted: 19 Dec 2014 11:22
by norel
Hi,

I have troubles with reading HLS streams with special characters with VLC.

VLC seems to build the url strangely, it doesn't seem to replace the correct parts. When the URL prefixes in the m3u8 are simpler, the stream works perfectly, but not in my case when I need to send complex authentification information.

I suspect that VLC decodes some parts of the authentication key and misinterprets them, but I don't know if something's wrong in the m3u8 file or if it is a VLC bug.

The logs below are logs from my iOS application using VLCKit (parts are replaced with "xxx" for lisibility). The VLC application crashes when I try to call the same URL


2014-12-19 10:49:17.059 Cloud Orange[1169:d603] RTCReporting: resolve from http://pancake.apple.com/bags/hls?version=4.12
2014-12-19 10:49:17.100 Cloud Orange[1169:607] -[MYCOMediaPlayer prepareToPlayAsset:withKeys:][line 470][DEBUG] asset prepared
[0e149524] httplive stream: HTTP Live Streaming (streaming09.cloud.wanadoo.fr/pcmorangepreprodcloud00000000234/urn%3Aufapi%3Aobject%3Amyco%3A71dafe2a-151d-4c85-a714-cbf6a31d5714%3Bformat%3Dmanifest/playlist.m3u8?SESSIONID=xxxA%2Baa%2Fxxx%2F%2BMrxxx%2FdWSutSQ%3D%3D)
2014-12-19 10:49:20.321 Cloud Orange[1169:607] -[MYCOMediaPlayer initScrubberTimer][line 259][DEBUG] adding time observer for avplayer
2014-12-19 10:49:20.322 Cloud Orange[1169:607] -[MYCOMediaPlayer onReadyToPlay][line 320][DEBUG] starting track
[0e459cf4] http access error: error: HTTP/1.1 403 Forbidden
[0e149524] core stream error: no suitable access module for `https://streaming09.cloud.wanadoo.fr/pc ... /dWSutSQ=='
[0e149524] httplive stream error: downloading segment 1 from stream 2 failed
[0e149524] httplive stream error: fetching first segment failed.


playlist.M3U8 file content :

Code: Select all

#EXTM3U #EXT-X-VERSION:1 ## Created with Unified Streaming Platform(version=1.6.6) #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=470956,CODECS="mp4a.40.2,avc1.66.30",RESOLUTION=180x240 ./urn:ufapi:object:myco:71dafe2a-151d-4c85-a714-cbf6a31d5714;format=manifest-audio=65299-video=379000.m3u8?SESSIONID=xxxA%2Baa/xxx/%2BMrxxx/dWSutSQ== #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=926756,CODECS="mp4a.40.2,avc1.66.30",RESOLUTION=270x360 ./urn:ufapi:object:myco:71dafe2a-151d-4c85-a714-cbf6a31d5714;format=manifest-audio=65299-video=809000.m3u8?SESSIONID=xxxA%2Baa/xxx/%2BMrxxx/dWSutSQ== #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=69216,CODECS="mp4a.40.2" ./urn:ufapi:object:myco:71dafe2a-151d-4c85-a714-cbf6a31d5714;format=manifest-audio=65299.m3u8?SESSIONID=xxxA%2Baa/xxx/%2BMrxxx/dWSutSQ==
second m3u8 file content :

Code: Select all

#EXTM3U #EXT-X-VERSION:1 ## Created with Unified Streaming Platform(version=1.6.6) #EXT-X-MEDIA-SEQUENCE:1 #EXT-X-ALLOW-CACHE:NO #EXT-X-TARGETDURATION:8 #EXTINF:8, no desc ./urn:ufapi:object:myco:71dafe2a-151d-4c85-a714-cbf6a31d5714;format=manifest-audio=65299-video=809000-1.ts?SESSIONID=xxxA%2Baa/xxx/%2BMrxxx/dWSutSQ== #EXTINF:6, no desc ./urn:ufapi:object:myco:71dafe2a-151d-4c85-a714-cbf6a31d5714;format=manifest-audio=65299-video=809000-2.ts?SESSIONID=xxxA%2Baa/xxx/%2BMrxxx/dWSutSQ== #EXT-X-ENDLIST
edit = added more info

Thanks!

Re: Reading m3u8 files containing special characters

Posted: 06 Jan 2015 11:20
by norel
To simplify the problem, it just seems that VLC takes into account the "/" that are contained in the URL parameter "SESSIONID". And it thinks that they still are part of the path.

I tried to make a patch for VLC that just ignores what is after the "?" so that the parameter value doesnt interfere with the path.

But at the same time I wonder if the "/" should not already be encoded in the URL, and if the problem is not simply caused by an badly constructed URL, instead of VLC.

What do you think?

Re: Reading m3u8 files containing special characters

Posted: 06 Jan 2015 11:48
by Jean-Baptiste Kempf
I'm not sure "/" are allowed in arguments.

Re: Reading m3u8 files containing special characters

Posted: 06 Jan 2015 14:28
by norel
According to this article, the character "/" is a valid character for parameter names and values :

http://blog.lunatech.com/2009/02/03/wha ... inktheyare

Special characters in URL seem to be more complex than we think ;)

Re: Reading m3u8 files containing special characters

Posted: 06 Jan 2015 22:03
by Jean-Baptiste Kempf
Ah, indeed. No idea, sorry.

Re: Reading m3u8 files containing special characters

Posted: 07 Jan 2015 15:44
by RĂ©mi Denis-Courmont
According to this article, the character "/" is a valid character for parameter names and values :

http://blog.lunatech.com/2009/02/03/wha ... inktheyare

Special characters in URL seem to be more complex than we think ;)
As far as I remember, VLC does not support relative URL resolution - only relative file paths resolution. But even if it did, I see no ways to detect which resolution rules to apply here. M3U is underspecified; we cannot know if the string is a URI or a path if it is not absolute (and even if it is absolute, it's a bit fuzzy).