Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotation marks in VIDEO-RANGE property #289

Closed
vevv opened this issue Jul 25, 2022 · 9 comments
Closed

Quotation marks in VIDEO-RANGE property #289

vevv opened this issue Jul 25, 2022 · 9 comments

Comments

@vevv
Copy link
Contributor

vevv commented Jul 25, 2022

According to the specification, this is an enumerated-string property, with SDR, HDR and PQ as valid values. Enumerated strings should not contain quotes, see #285 for string type definitions.

Video range definition:

VIDEO-RANGE
The value is an enumerated-string; valid strings are SDR, HLG and PQ.

Easy to fix: video_range needs to be added the params passed to remove_quotes_parser here.

@mauricioabreu
Copy link
Member

Hello @vevv thank your for reporting the problem.
Can you provide an example? I couldn't find in the code where these quotation marks are being used to enclosure video range values.

@bbayles
Copy link
Contributor

bbayles commented Jul 29, 2022

I think the library currently does the right thing.

There's an example playlist with VIDEO-RANGE here.

You can see from this snippet that the SDR value is correctly not quoted after a loads and dumps cycle.

In [5]: from m3u8 import loads as m3u8_loads

In [6]: m3u8_loads('''#EXTM3U
   ...: #EXT-X-VERSION:7
   ...: #EXT-X-INDEPENDENT-SEGMENTS
   ...: #EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2778321,BANDWIDTH=3971374,VIDEO-RANGE=SDR,CODECS="hvc1.2.4.L123.B0",RESO
   ...: LUTION=1280x720,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP-LEVEL=NONE
   ...: sdr_720/prog_index.m3u8''')
Out[6]: <m3u8.model.M3U8 at 0x7fbe33975850>

In [7]: print(_.dumps())
#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-VERSION:7
#EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,BANDWIDTH=3971374,AVERAGE-BANDWIDTH=2778321,RESOLUTION=1280x720,FRAME-RATE=23.976,CODECS="hvc1.2.4.L123.B0",VIDEO-RANGE=SDR,HDCP-LEVEL=NONE
sdr_720/prog_index.m3u8

@bbayles
Copy link
Contributor

bbayles commented Jul 29, 2022

These playlists in the test suite do seem to have strange trailing quotes; those should probably be removed.

@mauricioabreu
Copy link
Member

Thank you @bbayles removed and pushed to master already

@mauricioabreu
Copy link
Member

mauricioabreu commented Jul 29, 2022

May I close this issue @vevv ?

@vevv
Copy link
Contributor Author

vevv commented Jul 29, 2022

Example playlist I've ran into:

#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-STREAM-INF:BANDWIDTH=3118046,AVERAGE-BANDWIDTH=2044147,CODECS="avc1.64001f,ec-3,mp4a.40.2",RESOLUTION=854x480,FRAME-RATE=23.976,VIDEO-RANGE="SDR",HDCP-LEVEL="TYPE-0",AUDIO="eac-3",SUBTITLES="sub-main"
composite_1800k_CENC_CTR_FHD_SDR_4bf2c619-d3f6-f558-a2ac-d6ff17cf7b1c_2a70be20-47bf-11cb-a730-b7d0f86ea198.m3u8

SDR is quoted, I suppose this is a faulty playlist then. Still, would be nice to strip it in the library for those cases.

@mauricioabreu
Copy link
Member

@vevv cool! I added the video_range to the line you said. It should fix the problem. Thank you!

@dlarrick
Copy link

Greetings,
The fix that was added for this issue is necessary but not sufficient.

https://github.com/globocom/m3u8/blob/master/m3u8/parser.py#L328 adds video_range to the list of fields that will be de-quoted if needed.
However, https://github.com/globocom/m3u8/blob/master/m3u8/parser.py#L337 overwrites this assignment with plain str so video_range does not, in fact, have quotes removed.

I can open a new issue if that's preferred.

@mauricioabreu
Copy link
Member

@dlarrick please do it. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants