globocom / m3u8

Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions
Other
1.98k stars 464 forks source link

RESOLUTION as float raises exception #355

Closed daveisfera closed 2 months ago

daveisfera commented 5 months ago

The RESOLUTION value in EXT-X-STREAM-INF is listed as being a decimal value so some outputs list it with .0 and that causes the parsing to fail ( see https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4.2 )

davemevans commented 5 months ago

RESOLUTION is defined as a decimal-resolution, which is defined in https://datatracker.ietf.org/doc/html/rfc8216#section-4.2 as two decimal-integers seperated by an x.

So my understanding is that floating point values in RESOLUTION are not legal.

That does not mean that there aren't playlists around that include floating point resolutions of course ...

mauricioabreu commented 5 months ago

I understand the approach here @daveisfera, reaching more and diverse formtas/playlists, but I'm with @davemevans here. IPTV and pirate content have some very weird definition set (some nonsense datatypes/values). Welcoming these differences might be a good idea in theory, but in practice it could make m3u8 a simple key/value parser.

leandromoreira commented 5 months ago

The main/most used video codec seems to use an unsigned integer to represent width, https://github.com/globocom/m3u8/pull/356#issuecomment-1931888312

daveisfera commented 2 months ago

RESOLUTION is defined as a decimal-resolution, which is defined in https://datatracker.ietf.org/doc/html/rfc8216#section-4.2 as two decimal-integers seperated by an x.

That definitely does mean that having .0 on RESOLUTION makes it out of spec, so I'm ok with rejecting this