我正在尝试在 python 中连接 .m3u8 播放列表中存在的 .ts 文件,
有什么办法可以做到吗???如果是,请解释一下如何
提前致谢
这应该可行,我只在这个简短的脚本中添加了两条注释,因为我想它几乎是不言自明的。
import shutil
# Parse playlist for filenames with ending .ts and put them into the list ts_filenames
with open('playlist.m3u8', 'r') as playlist:
ts_filenames = [line.rstrip() for line in playlist
if line.rstrip().endswith('.ts')]
# open one ts_file from the list after another and append them to merged.ts
with open('merged.ts', 'wb') as merged:
for ts_file in ts_filenames:
with open(ts_file, 'rb') as mergefile:
shutil.copyfileobj(mergefile, merged)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)