-
Notifications
You must be signed in to change notification settings - Fork 464
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
Dump and dumps functions do not show subtitles and audio fields added to stream_info #301
Comments
Try this code: import m3u8
m3u8_text = """
#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-VERSION:5
#EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,BANDWIDTH=2516370,AVERAGE-BANDWIDTH=2516370,RESOLUTION=1280x720,CODECS="mp4a.40.2,avc1.640020"
video_720p.m3u8
#EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,BANDWIDTH=1640580,AVERAGE-BANDWIDTH=1640580,RESOLUTION=960x540,CODECS="mp4a.40.2,avc1.640020"
video_540p.m3u8
"""
m3u8_obj = m3u8.loads(m3u8_text)
nepali_audio = m3u8.Media(uri='audios/Nepali/master.m3u8', type='AUDIO', group_id='Audio', language='np', name='Nepali', default='YES', autoselect='YES')
m3u8_obj.add_media(nepali_audio)
german_audio = m3u8.Media(uri='audios/German/master.m3u8', type='AUDIO', group_id='Audio', language='de', name='German', default='NO', autoselect='NO')
m3u8_obj.add_media(german_audio)
nepali_subs = m3u8.Media(uri=f'subtitles/Nepali/master.m3u8', type='SUBTITLES', group_id='Subtitle', language='np', name='Nepali', forced='NO', autoselect='NO')
m3u8_obj.add_media(nepali_subs)
german_subs = m3u8.Media(uri=f'subtitles/German/master.m3u8', type='SUBTITLES', group_id='Subtitle', language='de', name='German', forced='NO', autoselect='NO')
m3u8_obj.add_media(german_subs)
for playlist in m3u8_obj.playlists:
playlist.media += [nepali_audio, german_audio, nepali_subs, german_subs]
print(m3u8_obj.dumps()) |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to inject audios and subtitles in m3u8 file. The first step is to add new audios and subtitles as media. The second step would be to add subtitle and audio field in the renditions list.
The initial file looked like this:
The modified file should look like this:
With the code below the medias get added successfully but the AUDIO and SUBTILES fields do not get added in the lines starting with
#EXT-X-STREAM-INF
. The problem lies in thedump
function.'I request you to fix the dump and the dumps function to add the above fields.
The text was updated successfully, but these errors were encountered: