spotify-downloader: FFmpeg behaviour on wrong version
Reviewing the code in download.py also reveals a failure to check returns codes from the spawned ffmpeg process, and that’s the root cause of the problem I’ve encountered. If ffmpeg fails for any reason, the spotDL code will keep on working. If the output file isn’t written, it ends up hanging with 100% CPU usage due the loop I quoted above.
For me, the issue is that I’ve got ffmpeg version 7:4.1.6-1 installed. This is the newest official version for the Raspberry Pi:
$ sudo apt install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
ffmpeg is already the newest version (7:4.1.6-1~deb10u1+rpt1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
However, that version doesn’t support the pad_dur option for the apad filter. spotDL passes this filter in the chian (as apad=pad_dur=2). ffmpeg fails, that failure isn’t detected; ffmpeg writes a zero-byte output file, spotDL doesn’t care to check, and crashes.
Getting a newer version of ffmpeg from snap exchanges this problem for another issue:
$ sudo snap install ffmpeg --classic
2021-01-25T15:54:27-08:00 INFO Waiting for restart...
ffmpeg N-76538-gb83c849 from Snapcrafters installed
Channel latest/stable for ffmpeg is closed; temporarily forwarding to stable.
because that version doesn’t support the -abr option. I’ll hve to find a way to get a version compatible with spotDL.
Until then, a raw Python stack dump is pretty harrowing for most users. Maybe the spotDL developers will consider any of these suggestions to improve matters for their users:
- Document the required version of ffmpeg as 4.2 or newer (when
pad_dursupport was added) - Check the ffmpeg version at startup; if older, omit the
pad_durparameter; perhaps with a warning message - add code that checks the
process.returncodeindownload.pyto see if the spawned process failed or worked; if it fails, do something sensible instead of trying to process a broken output file - catch the piped output from the process to develop a clear error message.
ffmpegshows the user an actionable error message - add a
--debugoption to the script to share more output
Reinstalling Python, as recommended above, won’t fix this issue.
_Originally posted by @mikeblas in https://github.com/spotDL/spotify-downloader/issues/934#issuecomment-767195102_
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 33 (13 by maintainers)
I got the good ffmpeg version on my path and it still yelling about not finding ffmpeg version, anyone got this error might want to use
--ignore-ffmpeg-version.You can try Jonathon build but idk if it will work
Thanks, it worked, but now spotdl get stuck on Converting with 90% progress? Is there a fix for this?