You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 the dump function.'
import m3u8
manifest file = './tmp/manifest.m3u8'
m3u8_obj = None
with open(manifest_file, 'r') as manifest:
content = manifest.read()
m3u8_obj = m3u8.loads(content)
# Add audios media
new_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(new_audio)
new_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(new_audio)
# Add subtitle media
new_subtitle = 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(new_subtitle)
new_subtitle = 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(new_subtitle)
# Trying to add audio and subtitles field in renditions
for playlist in m3u8_obj.playlists:
stream_info = playlist.stream_info
stream_info.audio = 'Audio'
stream_info.subtitles = 'Subtitle'
print( m3u8_obj.dumps())
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:
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: