Commit Graph

542 Commits

Author SHA1 Message Date
rlaphoenix 86322159b6 Fix multiplexing of downloads without a video track
E.g., --subs-only and --audio-only
2023-04-17 14:09:36 +01:00
rlaphoenix 96aa7c1e0a Fix segmented vtt merging code
This got 'broken' after moving to my fork of pymp4 because my fork has commits by TrueDread that add support for the vttc, payl, and sttg boxes, therefore they no longer contain `data` fields but rather specifically parsed fields. I also no longer need to parse the data stream of vttc boxes, as they are already parsed as `children`.
2023-04-04 20:15:18 +01:00
rlaphoenix 62965f8e21 Skip tenc boxes that are not version 0 or 1
It seems tenc boxes should only be 0 or 1, yet sometimes it can be above that. It seems some services accidentally use the `tenc` atom code over another. E.g., Netflix sometimes using `tenc` instead of `avc1`.
2023-03-28 21:27:43 +01:00
rlaphoenix eb39c8eba6 Ensure QualityList returns resolutions in descending order 2023-03-28 20:46:13 +01:00
rlaphoenix b301fb4390 Use tenc boxes within uuid boxes as another fallback for get_key_id 2023-03-28 20:25:30 +01:00
rlaphoenix 5b7fadbc55 Use -nobom with CCExtractor 2023-03-27 19:25:21 +01:00
rlaphoenix 527cd4cca1 Fix regression where only last mux would be moved to dl folder 2023-03-27 18:51:32 +01:00
rlaphoenix 8c14b73bc1 Replace abandoned pymp4 with my fork of pymp4
My fork contains various fixes by beardypig and truedread that do not have a release on PyPI yet.
2023-03-27 18:41:28 +01:00
rlaphoenix 0a128e1f70 Fix regression where no-video dls fail, improve multiplex progress 2023-03-26 23:13:11 +01:00
rlaphoenix 8f5bbeb8e3 Split the download finished log into dl/title finish logs 2023-03-26 22:42:16 +01:00
rlaphoenix 0b2e3e2255 Remove the muxed download path log
It's not very appealing, nor is it info the user realistically needs for every download. They could check `devine env info` to see where downloads go if they are unsure.
2023-03-26 22:41:23 +01:00
rlaphoenix 2a8e86b057 Delete video tracks as they are muxed
This reduces the total cumulative temp download folder size.
2023-03-26 22:40:05 +01:00
rlaphoenix 0c6d0986e4 Remove now unused and superseded with_resolution method 2023-03-26 20:21:31 +01:00
rlaphoenix 63eeeca910 Fix regression where all videos are selected if --quality isnt used 2023-03-26 20:18:15 +01:00
Hollander_1908 d894e5bbe0
Was not able to use the initialization from a DASH segment_list (#47)
* Was not able to use the initialization from a DASH segment_list

* Check if initialization in DASH has attribute range
2023-03-26 20:01:17 +01:00
rlaphoenix 33a9c307f3 Add ability to download multiple resolutions per title
Closes #26
2023-03-26 19:28:46 +01:00
rlaphoenix 71cf2b4016 Fix rare issue where DASH/HLS dl speed divides by 0 2023-03-26 14:30:12 +01:00
rlaphoenix 1c73e8d7fa Fix CCExtractor failing in edge cases by repacking first 2023-03-26 12:04:16 +01:00
rlaphoenix bf3219b4e8 Ignore empty files when decrypting with Widevine
This happens because the input file has no actual useful data, likely just a bunch of headers and nothing of use. Therefore shaka skips and returns OK, yet didnt make any file at the decrypted path.

This fixes a crash when it tries to move the non-existent decrypted file to the input file location, causing the rest of the download to halt.
2023-03-17 21:09:09 +00:00
rlaphoenix f4a9d6c0b1 Replace negative size values in TTML text with 0
Negative size values are not allowed by the spec basically anywhere in the document. Some services seem to accidentally specify a negative value which puts pycaption on a fritz.
2023-03-17 19:28:55 +00:00
rlaphoenix 41018d4574 Don't absorb error messages on Caption Syntax Errors 2023-03-17 18:56:53 +00:00
rlaphoenix 2a4dfb3e93 Improve anti-duplicate checks in Widevine tree logs
While it already has anti-duplicate checks, these checks did not take into account the `*` indicator, or `from x vault` e.t.c. This rework of the duplicate check ignores all messages.
2023-03-17 01:52:47 +00:00
rlaphoenix df4dd73271 Bump to v2.1.0 2023-03-16 20:51:45 +00:00
rlaphoenix 6e888a095e Silence SubtitleEdit when stripping SDH 2023-03-16 20:49:23 +00:00
rlaphoenix c778a890cf Fix calls for Audio & Subtitle's OnMultiplex event 2023-03-15 05:50:12 +00:00
rlaphoenix 0ac1955db6 Ignore aria2's "If errors see the log file" logs 2023-03-15 03:13:41 +00:00
rlaphoenix d3cfc722dc
Merge pull request #43 from Hollander-1908/patch-1
DASH: improved forced subtitle recognition
2023-03-14 12:39:21 +00:00
rlaphoenix cd2831fe82 Add Hollander-1908 to Contributors list 2023-03-14 12:39:05 +00:00
Hollander_1908 5eedbe1f59
DASH: improved forced subtitle recognition
Some manifests uses value `forced_subtitle` instead of the regular `forced-subtitle`.
This way both are recognized.
2023-03-14 12:56:34 +01:00
rlaphoenix 36c530ccc6 Add support for JS-style 13-char timestamps to Cacher 2023-03-13 22:48:49 +00:00
rlaphoenix ddf1c519e0 Try get track language from representation ID on DASH playlists 2023-03-13 01:09:52 +00:00
rlaphoenix 7ca58c96ab Shorten variable `aria_log_buffer` to `log_buffer` 2023-03-12 00:12:48 +00:00
rlaphoenix 90818f201d Include the mkvmerge return code on error 2023-03-12 00:10:54 +00:00
rlaphoenix d8acdda044 Silence DASH and HLS logs unless it's the last attempt 2023-03-12 00:09:02 +00:00
rlaphoenix 055bc927f5 Add a 5-attempt retry system to DASH & HLS downloads 2023-03-11 19:28:02 +00:00
rlaphoenix 111dac9264 Fix association of preceding HLS EXT-X-KEYs with m3u8 fork
This will improve efficiency and accuracy of getting appropriate DRM systems when downloading segments.

This can dramatically improve download speed from less than 50 kb/s to full speed if the HLS playlist used a lot of AES-128 EXT-X-KEYs. E.g., a unique key for each segment.

This was caused because the HLS.get_drm function took EVERY EXT-X-KEY, checked for supported systems, loaded them, and returned the supported objects. This meant it could load possibly 100s of AES-128 ClearKey objects (likely requiring URL downloads for the key URI) causing a huge delay before downloading each segment.
2023-03-09 21:46:48 +00:00
rlaphoenix 7bb215d496 Prevent licensing Widevine DRM a second time
If you use --cdm-only, you will end up licensing multiple times if the PSSH has more than one Key ID. While this is checked for, with the KID check now being more lenient, it will end up continuing and licensing again.

However, even with the original check code this would have been pointless. If the first license did not return a content key for a KID, then the next license call with the exact same parameters wouldn't have either
2023-03-08 22:48:36 +00:00
rlaphoenix abf6c71688 Specify HLS Track Key IDs to prepare_drm
This also moves the init data code before drm related code, just so it has the init data ready to retrieve the Key ID from.
2023-03-08 22:45:41 +00:00
rlaphoenix da7acb0417 Specify URL Track Key IDs to prepare_drm 2023-03-08 22:42:25 +00:00
rlaphoenix a549cc6afb Specify DASH Track Key IDs to prepare_drm 2023-03-08 22:41:58 +00:00
rlaphoenix 923cb71f81 Only raise error if the Track's KID was not found when licensing
For ex., if a service has the same PSSH or license call for 720p and 1080p video tracks, but it doesn't return a KID for the 1080p track, then the previous code would return an error, even though it has enough content key data to continue.

With this change it now only raises the error if the track's exact KID was not licensed. This adds support to prepare_drm for specifying the track's KID.
2023-03-08 22:41:13 +00:00
rlaphoenix 73bd17ec94 Implement new get_key_id() method to Track 2023-03-08 22:36:21 +00:00
rlaphoenix 853a021ac0 Fix regression in new get_init_segment, change fallback_size to maximum_size
When the Content-Size is successfully determined, it still uses the (now called maximum_size) as it could otherwise be MBs or GBs worth of data.
2023-03-08 22:27:38 +00:00
rlaphoenix 573dd8cd49 Don't immediately license DASH DRM until used
This is unnecessary as the DASH track may get converted into an URL track, which will also prepare the DRM.
2023-03-08 21:42:05 +00:00
rlaphoenix 8337162991 Prepare DRM on URL tracks if they already have DRM
Previously it would only prepare the DRM, if it had to find DRM from the init data. Now it prepares DRM if already pre-provided with DRM objects.
2023-03-08 21:35:14 +00:00
rlaphoenix d73256f1b3 Fix storing of DRM to be before preparation on URL tracks 2023-03-08 21:31:44 +00:00
rlaphoenix 32c118ab57 Rewrite Track's get_init_segment method, now more dynamic
- DASH and HSL tracks must now explicitly provide the URL to download as the init segment. This is because the original code assumed the first segment, or first init segment was the one that the caller wants, which may not be the case (e.g., and ad is the first init segment).

It now supports explicitly providing a byte-range to download, as well as modifying the fallback content size of 20KB.

It now also checks if the server supports the HTTP Range header and uses it over the hacky request-streaming method. It also checks for the file size and uses that over the fallback size as long as it's not bigger than 100 KB.

Overall it's now more dynamic to specific use-cases, and more efficient in various ways.
2023-03-08 21:08:50 +00:00
rlaphoenix 4f1d94dd7b Remove list unpack from Widevine's from_track for HLS tracks
This isn't actually necessary. Likely hasn't been necessary since either v1.0.0, or v1.2.0.
2023-03-08 20:43:25 +00:00
rlaphoenix cbd796463d Ignore "aria2 will resume download" logs
These only happen if we intentionally cancel the process, or failed. However, this is something that is generally obvious given the args, and when cancelling a wall of these logs would appear.
2023-03-08 13:46:55 +00:00
rlaphoenix fa84ef53e7 Don't space the `*` that denotes KIDs within PSSH
This prevents it from being 1 character over the size limit and wrapping to the next line.
2023-03-08 13:43:11 +00:00