ytdl_hook fails due to large amounts of JSON data
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 37k
- Forks
- 3.5k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 22
Description
Important Information
Provide following Information:
- mpv version
mpv 0.35.1-dirty Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
built on Wed Mar 22 08:19:26 2023
FFmpeg library versions:
libavutil 58.2.100
libavcodec 60.3.100
libavformat 60.3.100
libswscale 7.1.100
libavfilter 9.3.100
libswresample 4.10.100
FFmpeg version: n6.0
- Linux Distribution and Version
Arch. uname -a:
Linux archfx 6.2.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 07 Apr 2023 02:10:43 +0000 x86_64 GNU/Linux
- Source of the mpv binary
Official pacman repositories. pacman -Qi mpv:
Name : mpv
Version : 1:0.35.1-4
Description : a free, open source, and cross-platform media player
Architecture : x86_64
URL : https://mpv.io/
Licenses : GPL3
Groups : None
Provides : libmpv.so=2-64
Depends On : alsa-lib libasound.so=2-64 desktop-file-utils ffmpeg libavcodec.so=60-64 libavdevice.so=60-64
libavfilter.so=9-64 libavformat.so=60-64 libavutil.so=58-64 libswresample.so=4-64 libswscale.so=7-64 glibc
hicolor-icon-theme jack libjack.so=0-64 lcms2 liblcms2.so=2-64 libarchive libarchive.so=13-64 libass
libass.so=9-64 libbluray libbluray.so=2-64 libcdio libcdio-paranoia libdrm libdvdnav libdvdread libegl libgl
libglvnd libjpeg libjpeg.so=8-64 libplacebo libplacebo.so=229-64 libpulse libpulse.so=0-64 libva
libva.so=2-64 libva-drm.so=2-64 libva-wayland.so=2-64 libva-x11.so=2-64 libvdpau libx11 libxext libxinerama
libxkbcommon libxkbcommon.so=0-64 libxpresent libxrandr libxss libxv luajit mesa mujs libpipewire
rubberband librubberband.so=2-64 shaderc libshaderc_shared.so=1-64 uchardet vulkan-icd-loader wayland zlib
Optional Deps : yt-dlp: for video-sharing websites playback [installed]
youtube-dl: for video-sharing websites playback
Required By : None
Optional For : anki-bin
Conflicts With : None
Replaces : None
Installed Size : 6.09 MiB
Packager : Christian Hesse <eworm@archlinux.org>
Build Date : Wed 22 Mar 2023 20:19:26 GMT
Install Date : Fri 24 Mar 2023 20:03:58 GMT
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature
- If known which version of mpv introduced the problem
Unknown - I was watching similar videos yesterday, and with no system changes, this video I found today doesn't work.
- Window Manager and version
i3wm. i3 -v:
i3 version 4.22 (2023-01-02) © 2009 Michael Stapelberg and contributors
- GPU driver and version
amdgpu. Snipped lspci -v:
09:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev e7) (prog-if 00 [VGA controller])
Subsystem: Sapphire Technology Limited Nitro+ Radeon RX 570/580/590
Flags: bus master, fast devsel, latency 0, IRQ 69, NUMA node 0
Memory at c0000000 (64-bit, prefetchable) [size=256M]
Memory at d0000000 (64-bit, prefetchable) [size=2M]
I/O ports at b000 [size=256]
Memory at fe400000 (32-bit, non-prefetchable) [size=256K]
Expansion ROM at 000c0000 [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: amdgpu
Kernel modules: amdgpu
- Possible screenshot or video of visual glitches
Not relevant.
Reproduction steps
Issue persists with --no-config.
- install mpv and yt-dlp;
- ensure
yt-dlp 'https://www.youtube.com/watch?v=7Ip-zi-C66s'works and cancel it once you see it starting to download; - run
mpv 'https://www.youtube.com/watch?v=7Ip-zi-C66s'
Expected behavior
- mpv draws a window and plays a video
Actual behavior
- ytdl_hook fails with an error
[ytdl_hook]
[ytdl_hook] youtube-dl failed: failed to parse JSON data: error
Failed to recognize file format.
Exiting... (Errors when loading file)
Log file
output.txt (large)
Sample files
Not needed.
I notice that the amount of JSON ytdl_hook spits to the console is immense, and ends halfway through a string, breaking the JSON format. I also notice that the log file is suspiciously close to 64MiB in size. I am of course but a stupid idiot, but I wonder if there's something in ytdl_hook that's truncating something to that size, and this video for some reason overruns that limit.
Please note that mpv 'https://www.youtube.com/watch?v=aKNQPhVucVY' works fine so it's not all youtube videos, and mpv 'https://www.youtube.com/watch?v=k-9keDEstMg' works fine too, so it's not even live streams or recent live streams or stream archives that are the issue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ytdl_hook entry point and reproduce the failure using the provided YouTube URL, yt-dlp, and the linked output.txt log. Inspect where the large JSON response is handled and whether the observed 64 MiB boundary is involved. Done means mpv can load and play this video without a JSON parsing or file-format error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100