alexta69 / metube

Self-hosted YouTube downloader (web UI for youtube-dl / yt-dlp)
GNU Affero General Public License v3.0
5.83k stars 357 forks source link

Can't download Instagram videos/reals in an iOS compatiable codec #469

Open Jarboer opened 1 month ago

Jarboer commented 1 month ago

For some reason Instagram videos/reals are the only videos I download that aren't compatible with iOS since they download as VP9 instead of h.264. Videos from Twitter work fine for me.

I've tried using the Quality: Best (iOS) and Format: MP4 options but it doesn't work. I also tried setting the environment variable YTDL_OPTIONS to {"format": "mp4", "quality": "best_ios"} but that also doesn't change anything.

I'm running this in a TrueNAS app as the "apps" user (ID = 568). Here's an example reel that downloads in VP9 despite my settings: https://www.instagram.com/reel/C8MCIaDIJjV/?igsh=MWhodHRwcHQzdHkzeQ==.

Any help would be appericated if I'm missing something. And I can provide more details if needed.

Jarboer commented 1 month ago

Here's my logs, it does show the quality is best_ios

metube_metube-6dd9884f46-4l49g_metube.log

PikuZheng commented 1 month ago

I don't think best_ios is a valid value https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#format-selection

Jarboer commented 1 month ago

@PikuZheng Thanks for the reply and link. I believe it should be valid though. It was added here: https://github.com/alexta69/metube/pull/455

Here's some examples of me using the different quality settings:


Using these settings:

Screenshot 2024-07-13 at 12 22 05 AM

This is the relevant logs:

2024-07-13 00:20:04.871689-04:00INFO:ytdl:adding https://www.instagram.com/reel/C8MCIaDIJjV/?igsh=MWhodHRwcHQzdHkzeQ==: quality='best_ios' format='mp4' already=None folder=None custom_name_prefix='' 2024-07-13 00:20:07.732477-04:00INFO:ytdl:downloading Video by j.o.herbert


If I use these settings:

Screenshot 2024-07-13 at 12 23 08 AM

I get this:

2024-07-13 00:23:10.197243-04:00INFO:ytdl:adding https://www.instagram.com/reel/C8MCIaDIJjV/?igsh=MWhodHRwcHQzdHkzeQ==: quality='best' format='mp4' already=None folder=None custom_name_prefix='' 2024-07-13 00:23:13.770840-04:00INFO:ytdl:downloading Video by j.o.herbert

PikuZheng commented 1 month ago

I never used it. Sorry. However, I also faced the problem of the annoying vp9 encoding format. I chose to make av01 the preferred format by setting "format_sort":["codec:avc:m4a"] in YTDL_OPTIONS. It works fine with youtube. But wait... Does Instagram provide videos in the corresponding format?

PikuZheng commented 1 month ago
/ # yt-dlp --list-formats https://www.instagram.com/reel/C8MCIaDIJjV/?igsh=MWhodHRwcHQzdHkzeQ== --cookies /downloads/.metube/cookies.txt
[Instagram] Extracting URL: https://www.instagram.com/reel/C8MCIaDIJjV/?igsh=MWhodHRwcHQzdHkzeQ==
[Instagram] C8MCIaDIJjV: Downloading video info
[info] Available formats for C8MCIaDIJjV:
ID                      EXT RESOLUTION │   FILESIZE  TBR PROTO │ VCODEC         VBR ACODEC     ABR ASR MORE INFO
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
dash-794956116038447ad  m4a audio only │ ≈ 72.15KiB  56k https │ audio only         mp4a.40.5  56k 44k DASH audio, m4a_dash
385501297831617v-0      mp4 540x960    │                 https │ unknown            unknown
385501297831617v-1      mp4 540x960    │                 https │ unknown            unknown
dash-1661688841233207vd mp4 720x1280   │ ≈276.61KiB 214k https │ vp09.00.31.08 214k video only         DASH video, mp4_dash
443611441717854v        mp4 1080x1920  │                 https │ unknown            unknown
dash-1887139295033561v  mp4 1080x1920  │ ≈395.29KiB 306k https │ vp09.00.40.08 306k video only         DASH video, mp4_dash

The "unknown" is actually AVC1, which may be because Instagram did not provide the correct information. So yt-dlp will not select it, but only vp09. https://github.com/yt-dlp/yt-dlp/issues/4390 fyi