Repository: yt-dlp
Issue: Request option to skip fragments if video size is not 1920x1080 (or other specified size)
Labels: enhancement,triage,core:downloader

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm requesting a feature unrelated to a specific site
- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
- [X] I've verified that I'm running yt-dlp version **2023.03.04** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)

### Provide a description that is worded well enough to be understood

Would it be possible to add an option to yt-dlp to skip any fragments where the video is not a specified size, for example 1920x1080?  Apparently it is possible to have a m3u8 link that when given to yt-dlp results in a mp4 file that has a mixture of frames that are 1920x1080 (the main video) and 1280x720 (start, ad breaks, and end).  This breaks some players and video editors.  I only want the parts that are 1920x1080.  I assume that a fragment can only contain frames of a single size but if that is not the case then I really only want to keep the frames that are 1920x1080 if that's possible.

To slightly complicate matters the video and the audio are downloaded separately, and for each video fragment there is a corresponding audio fragment.  So when  a video fragment is discarded, the corresponding audio needs to be discarded as well.

An example of such a file would be just about any unlocked video on the site nick.com, after obtaining the master.m3u8 link. What would be wanted is to keep all the fragments that are 1920x1080 but discard all those that are any other size (and discard the audio packets that go with those).

I tried using the --hls-split-discontinuity option but it appears to just stop at the first size change.  I thought perhaps it might create separate output files every time there was a size change but no such luck.

Shown below is verbose output from one run, but the m3u8 links are only good for a few minutes so you'd need to go to the web site and find any unlocked video (one that has a play button rather than a padlock icon) and get the current m3u8 link to run a test.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', '--no-part', '--restrict-filenames', 'https://topaz.dai.viacomcbs.digital/h/a/dG9wYXoxYGQxN2E3MDc4LTMyNzAtNGViYy04MDkxLWRhZmM2OWNhNGMzsCvEzcasELVJcieOvQBZNWYzYjQ2ODI3YjhiMTkwYjYyMDRjYjI2YWIwYGpGNXItNXpyQ1RHb1Q5S0g4eE1FWjVkN1AxRFIyYjV5cGhFWm8wTGU2Zk0/master.m3u8?hdnea=st=1686638938~exp=1686642538~acl=/h/a/dG9wYXoxYGQxN2E3MDc4LTMyNzAtNGViYy04MDkxLWRhZmM2OWNhNGMzsCvEzcasELVJcieOvQBZNWYzYjQ2ODI3YjhiMTkwYjYyMDRjYjI2YWIwYGpGNXItNXpyQ1RHb1Q5S0g4eE1FWjVkN1AxRFIyYjV5cGhFWm8wTGU2Zk0/*~id=98f7c0cd-67ad-473f-a208-c37bfd4830b8~hmac=f82a0fc73523bc5865081666c981d757bd896e095ec837f2e41e54f888ae43c1&originpath=/ondemand/hls/content/2627899/vid/mgid:arc:episode:shared.nick.us:d17a7078-3270-4ebc-8091-af47ddcbc691/CBF/streams/9e7adaa7-74a4-4541-b85c-768e1e5b220e/master.m3u8&CMCD=mtp%3D500%2Cot%3Dm%2Csf%3Dh%2Csid%3D%f3855dadb8-7503-43ba-ba08-ab34a9206e0a%22%2Csu']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (zip)
[debug] Python 3.8.10 (CPython x86_64 64bit) - Linux-5.4.0-150-generic-x86_64-with-glibc2.29 (OpenSSL 1.1.1f  31 Mar 2020, glibc 2.31)
[debug] exe versions: ffmpeg N-65014-g7c130d6911-static (setts), ffprobe N-65014-g7c130d6911-static
[debug] Optional libraries: Crypto-broken 2.6.1, certifi-2019.11.28, secretstorage-2.3.1, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
Current Build Hash: 91cad9f121c1f6f0a81b747415c46ecba0ff331ed38cc6433040b4ac7b6e15ca
yt-dlp is up to date (stable@2023.03.04)
[generic] Extracting URL: https://topaz.dai.viacomcbs.digital/h/a/dG9wYXoxYGQxN2E3MDc4LTMyNzAtNGViYy04MDkxLWRhZmM2OWNhNGMzsCvEzcasELVJcieOvQBZNWYzYjQ2ODI3YjhiMTkwYjYyMDRjYjI2YWIwYGpGNXItNXpyQ1RHb1Q5S0g4eE1FWjVkN1AxRFIyYjV5cGhFWm8wTGU2Zk0/master.m3u8?hdnea=st=1686638938~exp=1686642538~acl=/h/a/dG9wYXoxYGQxN2E3MDc4LTMyNzAtNGViYy04MDkxLWRhZmM2OWNhNGMzsCvEzcasELVJcieOvQBZNWYzYjQ2ODI3YjhiMTkwYjYyMDRjYjI2YWIwYGpGNXItNXpyQ1RHb1Q5S0g4eE1FWjVkN1AxRFIyYjV5cGhFWm8wTGU2Zk0/*~id=98f7c0cd-67ad-473f-a208-c37bfd4830b8~hmac=f82a0fc73523bc5865081666c981d757bd896e095ec837f2e41e54f888ae43c1&originpath=/ondemand/hls/content/2627899/vid/mgid:arc:episode:shared.nick.us:d17a7078-3270-4ebc-8091-af47ddcbc691/CBF/streams/9e7adaa7-74a4-4541-b85c-768e1e5b220e/master.m3u8&CMCD=mtp%3D500%2Cot%3Dm%2Csf%3Dh%2Csid%3D%f3855dadb8-7503-43ba-ba08-ab34a9206e0a%22%2Csu
[generic] master: Downloading webpage
[debug] Identified a direct video link
[generic] master: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] master: Downloading 1 format(s): 5081+audio0-American_English
[debug] Invoking hlsnative downloader on "https://topaz.dai.viacomcbs.digital/ondemand/hls/content/2627899/vid/mgid:arc:episode:shared.nick.us:d17a7078-3270-4ebc-8091-af47ddcbc691/CBF/streams/9e7adaa7-74a4-4541-b85c-768e1e5b220e/media/48558c8f8369b38f6dd50696a1ba45e7.m3u8?hdntl=exp=1686726373~acl=/*~id=98f7c0cd-67ad-473f-a208-c37bfd4830b8~data=hdntl~hmac=1b0a5c4f07b1fda663b98168f09595ee21b38c6769922c7cb41f7af021cfa914"
[hlsnative] Downloading m3u8 manifest
WARNING: Live HLS streams are not supported by the native downloader. If this is a livestream, please add "--downloader ffmpeg --hls-use-mpegts" to your command
[hlsnative] Total fragments: 414
[download] Destination: master-[master].f5081.mp4
[download] 100% of  932.28MiB in 00:03:12 at 4.84MiB/s
[debug] Invoking hlsnative downloader on "https://topaz.dai.viacomcbs.digital/ondemand/hls/content/2627899/vid/mgid:arc:episode:shared.nick.us:d17a7078-3270-4ebc-8091-af47ddcbc691/CBF/streams/9e7adaa7-74a4-4541-b85c-768e1e5b220e/media/7837cc908156191f9907af444be1df55.m3u8?hdntl=exp=1686726373~acl=/*~id=98f7c0cd-67ad-473f-a208-c37bfd4830b8~data=hdntl~hmac=1b0a5c4f07b1fda69595ee21b38c6769963b98168f022c7cb41f7af021cfa914"
[hlsnative] Downloading m3u8 manifest
WARNING: Live HLS streams are not supported by the native downloader. If this is a livestream, please add "--downloader ffmpeg --hls-use-mpegts" to your command
[hlsnative] Total fragments: 414
[download] Destination: master-[master].faudio0-American_English.mp4
[download] 100% of   26.21MiB in 00:01:38 at 271.79KiB/s
[debug] ffmpeg command line: ffprobe -show_streams 'file:master-[master].faudio0-American_English.mp4'
[Merger] Merging formats into "master-[master].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:master-[master].f5081.mp4' -i 'file:master-[master].faudio0-American_English.mp4' -c copy -map 0:v:0 -map 1:a:0 -bsf:a:0 aac_adtstoasc -movflags +faststart 'file:master-[master].temp.mp4'
Deleting original file master-[master].faudio0-American_English.mp4 (pass -k to keep)
Deleting original file master-[master].f5081.mp4 (pass -k to keep)
```