mpv-player / mpv-player/mpv

autocrop.lua:209: attempt to index local 'hwdec_current'

Open Beginner friendly
#16,739 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

os:linux
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

mpv Information
mpv v0.40.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
libplacebo version: v6.338.2
FFmpeg version: 7.1.1
FFmpeg library versions:
   libavcodec      61.19.101
   libavdevice     61.3.100
   libavfilter     10.4.100
   libavformat     61.7.100
   libavutil       59.39.100
   libswresample   5.3.100
   libswscale      8.3.100
Other Information
- Linux version: Alpine Linux
- Kernel Version: Linux hyperion.whynothugo.nl 6.15.11-0-stable #1-Alpine SMP PREEMPT_DYNAMIC 2025-08-20 17:29:36 x86_64 Linux 
- GPU Model: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 [Radeon RX 7900 XT/7900 XTX/7900 GRE/7900M] [1002:744c] (rev cc)
- Mesa/GPU Driver Version: OpenGL version string: 4.6 (Compatibility Profile) Mesa 25.2.1
- Window Manager and Version: sway version 1.11
- Source of mpv: Distribution packages
- Latest known working version: unknown
- Issue started after the following happened: n/a
Reproduction Steps

mpv --script=/usr/share/mpv/lua/autocrop.lua path/to/file.mkv

Expected Behavior

Should autocrop.

Actual Behavior

Does not autocrop. Logs the following:

● Video  --vid=1               (h264 1920x1080 23.976 fps) [default]
● Audio  --aid=1  --alang=en   (eac3 6ch 48000 Hz) [default]
● Subs   --sid=1  --slang=en   'English'
… More subtitle languages omitted…
[autocrop] 
[autocrop] stack traceback:
[autocrop] 	/usr/share/mpv/lua/autocrop.lua:265: in function 'handler'
[autocrop] 	mp.defaults:522: in function 'call_event_handlers'
[autocrop] 	mp.defaults:564: in function 'dispatch_events'
[autocrop] 	mp.defaults:515: in function <mp.defaults:514>
[autocrop] 	[C]: at 0x557e28b61e00
[autocrop] 	[C]: at 0x557e28b623b0
[autocrop] Lua error: /usr/share/mpv/lua/autocrop.lua:209: attempt to index local 'hwdec_current' (a nil value)
Using hardware decoding (vaapi).
AO: [pipewire] 48000Hz 5.1(side) 6ch double
VO: [gpu] 1920x1080 vaapi[nv12]
Log File

https://gist.githubusercontent.com/WhyNotHugo/24924c4acf3943e325c355fa2d184c1d/raw/92632a0a16397bae0c12e0e8a67c5c25bee92f3c/gistfile1.txt

Sample Files

No response

I carefully read all instruction and confirm that I did the following:
  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the autocrop.lua handler at /usr/share/mpv/lua/autocrop.lua:209 and the event path reported at line 265, then compare the script's hardware-decoding lookup with the attached log. Reproduce with mpv --script=/usr/share/mpv/lua/autocrop.lua path/to/file.mkv and verify that autocropping completes without the hwdec_current nil-value error.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.