lbry-desktop icon indicating copy to clipboard operation
lbry-desktop copied to clipboard

macOS: LBRY Desktop will not find ffmpeg executable

Open Geordon opened this issue 2 years ago • 5 comments

Using a Mac (OS 11.6.5), downloaded ffmpeg through Homebrew. Manually executed ffmpeg successfully, but LBRY client ver 0.52.6 is not picking up ffmpeg binary. Also not picking it up from ~/Library/Application Support/LBRY/ffmpeg

Geordon avatar Apr 11 '22 02:04 Geordon

As a workaround, use the configuration panel to manually enter a path to ffmpeg:

image

Use Command-Shift-Period if needed to reveal hidden paths. My installation was in /opt/homebrew/bin/ffmpeg.

Other info and installation tips: https://lbry.com/faq/video-publishing-guide#automatic

moodyjon avatar May 05 '22 14:05 moodyjon

On my system: (lbrynet.log)

2022-05-05 10:08:38,724 WARNING lbry.file_analysis:93: Unable to locate ffmpeg executable. Path: :/Users/username/Library/Application Support/LBRY/ffmpeg/bin:/usr/bin:/bin:/usr/sbin:/sbin

At some point I or homebrew added /opt/homebrew/bin to PATH via ~/.zprofile, but LBRY is not using that.

echo $PATH
/usr/local/go/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin

Mac-mini lbry % cat /etc/profile   
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
	eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
	[ -r /etc/bashrc ] && . /etc/bashrc
fi

Description of path_helper functionality:
http://www.softec.lu/site/DevelopersCorner/MasteringThePathHelper

Mac-mini lbry % cat ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

alias brew86="arch -x86_64 /usr/local/bin/brew"
alias pyenv86="arch -x86_64 pyenv"

# lbrysdk
export PYTHONUNBUFFERED=1
export EVENT_NOKQUEUE=1

# golang
export PATH=/usr/local/go/bin:${PATH}

Mac-mini lbry % cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Mac-mini lbry % ls -l /etc/paths.d
total 16
-rwxr-xr-x  1 root  wheel  23 Dec 27 18:57 100-rvictl
-rw-r--r--  1 root  wheel  18 Mar 15 10:23 go
Mac-mini lbry % cat /etc/paths.d/100-rvictl 
/Library/Apple/usr/bin
Mac-mini lbry % cat /etc/paths.d/go        
/usr/local/go/bin

moodyjon avatar May 05 '22 14:05 moodyjon

Using "open" in the shell works for me with no need to edit daemon_settings.yml. In that context the which-based lookup works.

Mac-mini ~ % open /Applications/LBRY.app

When clicking on LBRY icon in Dock it does not.

moodyjon avatar May 05 '22 14:05 moodyjon

@moodyjon thanks for the detailed reply. Can you recommend the simplest way on mac to make this work automagically for more users?

jessopb avatar Jul 11 '22 16:07 jessopb

Everything I find online says that the rules for MacOS apps and PATH keep changing, becoming obsolete:

https://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications

I think basically the problem is all these MacOS mechanisms are not understood well, and people tend to fall back to what they're familiar with: /etc/zprofile, $HOME/.zprofile, $HOME/.zshrc, etc. Users don't fiddle with "launchctl". At least I never learned to do that.

It might be possible to pick up PATH entries from the shell config files using something like:

subprocess.run("sh -l -c 'which ffmpeg'", shell=True)

Currently the code looks like:

    def _which_ffmpeg_and_ffmprobe(path):
        return shutil.which("ffmpeg", path=path), shutil.which("ffprobe", path=path)

https://github.com/lbryio/lbry-sdk/blob/30dd0c1e11d86d0677ed7088007dfab3433e81cf/lbry/file_analysis.py#L78

moodyjon avatar Jul 12 '22 16:07 moodyjon