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

Ability to auto select video by how many segments it has #26

Closed
num421337 opened this issue Sep 19, 2022 · 4 comments
Closed

Ability to auto select video by how many segments it has #26

num421337 opened this issue Sep 19, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@num421337
Copy link

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?

@nilaoda
Copy link
Owner

nilaoda commented Sep 19, 2022

What the streams look like? Please paste the streams screenshot

@num421337
Copy link
Author

num421337 commented Sep 19, 2022

image
image

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

@pythonkenyard
Copy link

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:

....

@nilaoda nilaoda added the enhancement New feature or request label Nov 12, 2022
@nilaoda
Copy link
Owner

nilaoda commented Dec 18, 2022

Available in new version

@nilaoda nilaoda closed this as completed Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants