N_m3u8DL-RE
N_m3u8DL-RE copied to clipboard
Ability to auto select video by how many segments it has
Common links I use have two primary formats both exactly the same except one has 1 segment and the other has multiple, if I have it auto select it will go for the one with multiple and end up downloading the same thing multiple times. This happens with both Video and Audio, is there a command that I can have it automatically choose the audio and video with 1 segment and the best quality otherwise?
What the streams look like? Please paste the streams screenshot
the ones I'd want to auto select are the 1280x720 with one segment and the highest bitrate, and then the audio as well with 1 segment and the highest bitrate
FYI what i do is grab the output then regex on the segment count to check for e.g. the below. it checks if there is 4 digits of segment count, then 3 etc etc.. on the 1080p stream. you could adapt yours to do similar. change the 1080 to 720, etc (code in python)
proc = subprocess.run(f'N_m3u8DL-RE "{self.mpd}"',stdout=subprocess.PIPE, text=True)
try:
regex_video_id = re.search("1080.+(video=\d{7}).+\s.\s\d{**4**}",proc.stdout)
print(regex_video_id.group(1))
regex_audio_id = re.search(".(audio.+=\d{6})\s.+mp4a.{1,25}\d{4}\sSegment",proc.stdout)
print(regex_audio_id.group(1))
except:
print("failed first regex")
try:
regex_video_id = re.search("1080.+(video=\d{7}).+\s.\s\d{3}",proc.stdout)
print(regex_video_id.group(1))
except:
....
Available in new version