diff --git a/src/lib/server/providers/ytdlp/index.ts b/src/lib/server/providers/ytdlp/index.ts index 484a7b0..fc0c8e3 100644 --- a/src/lib/server/providers/ytdlp/index.ts +++ b/src/lib/server/providers/ytdlp/index.ts @@ -113,11 +113,17 @@ export class YtDlpProvider implements DownloadProvider { const args = [ '--no-playlist', - // Prefer the best sub-1080p video+audio and merge; fall back to a muxed format, then - // anything. Sites like Instagram now serve split DASH streams that a bare `best` - // (muxed-only) selector can miss, so select streams explicitly and let FFmpeg merge. + // Prefer a browser-safe MUXED H.264 stream (playable in Safari/iOS), falling back to + // a DASH merge only when no muxed format exists. This matters because Instagram serves + // H.264 only as the muxed/progressive format while its video-only DASH is VP9, and + // YouTube's is AV1 — neither VP9 nor AV1 plays on iOS. The `-S` sort then biases every + // tier toward h264/aac so a merge fallback still picks compatible codecs when possible. '-f', - 'bv*[height<=1080]+ba/b[height<=1080]/b', + 'best[height<=1080]/best/bv*[height<=1080]+ba/bv*+ba', + '-S', + 'vcodec:h264,acodec:aac,res:1080', + '--merge-output-format', + 'mp4', '--write-thumbnail', '--convert-thumbnails', 'jpg',