From dc6a29c5a9c55ba5d28db23c9f56a9472fd09a74 Mon Sep 17 00:00:00 2001 From: GraysonCAdams Date: Wed, 8 Jul 2026 23:04:00 -0500 Subject: [PATCH] fix(providers): download browser-safe H.264 instead of VP9/AV1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bv*+ba selector grabbed the best video-only stream, which on Instagram is VP9 and on YouTube AV1 — neither plays in Safari/iOS, so uploads silently became unwatchable for the (iPhone-heavy) group. Prefer the muxed/progressive H.264 format, fall back to a DASH merge only when no muxed exists, and sort all tiers toward h264/aac (+ --merge-output-format mp4) so fallbacks stay compatible. Verified against affected Instagram reels: output is h264/aac mp4. --- src/lib/server/providers/ytdlp/index.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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',