diff --git a/Public API v1.yaml b/Public API v1.yaml index 22b57da..0418866 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -1589,6 +1589,10 @@ components: type: string description: Height of the video, if known example: '1080' + maxHeight: + type: string + description: Max height that should be used, useful for playlists. selectedHeight will override this. + example: '1080' maxBitrate: type: string description: Specify ffmpeg/avconv audio quality diff --git a/backend/app.js b/backend/app.js index 7ada2d6..f4c66ef 100644 --- a/backend/app.js +++ b/backend/app.js @@ -813,6 +813,7 @@ app.post('/api/downloadFile', optionalJwt, async function(req, res) { additionalArgs: req.body.additionalArgs, customOutput: req.body.customOutput, selectedHeight: req.body.selectedHeight, + maxHeight: req.body.maxHeight, customQualityConfiguration: req.body.customQualityConfiguration, youtubeUsername: req.body.youtubeUsername, youtubePassword: req.body.youtubePassword, @@ -843,6 +844,7 @@ app.post('/api/generateArgs', optionalJwt, async function(req, res) { additionalArgs: req.body.additionalArgs, customOutput: req.body.customOutput, selectedHeight: req.body.selectedHeight, + maxHeight: req.body.maxHeight, customQualityConfiguration: req.body.customQualityConfiguration, youtubeUsername: req.body.youtubeUsername, youtubePassword: req.body.youtubePassword, diff --git a/backend/downloader.js b/backend/downloader.js index 07d1857..c9b93fc 100644 --- a/backend/downloader.js +++ b/backend/downloader.js @@ -433,7 +433,8 @@ exports.generateArgs = async (url, type, options, user_uid = null, simulated = f if (customQualityConfiguration) { qualityPath = ['-f', customQualityConfiguration, '--merge-output-format', 'mp4']; } else if (heightParam && heightParam !== '' && !is_audio) { - qualityPath = ['-f', `'(mp4)[height${maxHeight ? '<' : ''}=${heightParam}]`]; + const heightFilter = (maxHeight && default_downloader === 'yt-dlp') ? ['-S', `res:${heightParam}`] : ['-f', `best[height${maxHeight ? '<' : ''}=${heightParam}]+bestaudio`] + qualityPath = [...heightFilter, '--merge-output-format', 'mp4']; } else if (is_audio) { qualityPath = ['--audio-quality', maxBitrate ? maxBitrate : '0'] } diff --git a/src/api-types/models/DownloadRequest.ts b/src/api-types/models/DownloadRequest.ts index 9740512..c7b6fe6 100644 --- a/src/api-types/models/DownloadRequest.ts +++ b/src/api-types/models/DownloadRequest.ts @@ -35,6 +35,10 @@ export type DownloadRequest = { * Height of the video, if known */ selectedHeight?: string; + /** + * Max height that should be used, useful for playlists. selectedHeight will override this. + */ + maxHeight?: string; /** * Specify ffmpeg/avconv audio quality */ diff --git a/src/app/main/main.component.html b/src/app/main/main.component.html index 3a33e99..91925e3 100644 --- a/src/app/main/main.component.html +++ b/src/app/main/main.component.html @@ -19,17 +19,24 @@ Quality - - - Max + + + Best - + {{option.key}} + + + + {{option.label}} + + +
@@ -60,7 +67,7 @@

- + Only Audio @@ -74,7 +81,7 @@ -