hanxi / xiaomusic

使用小爱音箱播放音乐,音乐使用 yt-dlp 下载。
https://github.com/hanxi/xiaomusic
MIT License
968 stars 95 forks source link

下载的webm找不到ffmpeg进行转换 #15

Closed ansemz closed 4 months ago

ansemz commented 5 months ago
[download] music/左手指月.webm has already been downloaded
[download] 100% of    6.94MiB
ERROR: Postprocessing: ffprobe and ffmpeg not found. Please install or provide the path using --ffmpeg-location

用的是python virtualenv的虚拟环境。也安装了ffmpeg。

$ which ffmpeg
/usr/local/bin/ffmpeg
$ tree
.
├── Dockerfile
├── ffmpeg
│   ├── bin
│   │   ├── ffmpeg
│   │   ├── ffplay
│   │   └── ffprobe
│   ├── doc
│   │   ├── bootstrap.min.css
│   │   ├── community.html
│   │   ├── default.css
│   │   ├── developer.html
│   │   ├── faq.html
│   │   ├── fate.html
│   │   ├── ffmpeg-all.html
│   │   ├── ffmpeg-bitstream-filters.html
│   │   ├── ffmpeg-codecs.html
│   │   ├── ffmpeg-devices.html
│   │   ├── ffmpeg-filters.html
│   │   ├── ffmpeg-formats.html
│   │   ├── ffmpeg.html
│   │   ├── ffmpeg-protocols.html
│   │   ├── ffmpeg-resampler.html
│   │   ├── ffmpeg-scaler.html
│   │   ├── ffmpeg-utils.html
│   │   ├── ffplay-all.html
│   │   ├── ffplay.html
│   │   ├── ffprobe-all.html
│   │   ├── ffprobe.html
│   │   ├── general.html
│   │   ├── git-howto.html
│   │   ├── libavcodec.html
│   │   ├── libavdevice.html
│   │   ├── libavfilter.html
│   │   ├── libavformat.html
│   │   ├── libavutil.html
│   │   ├── libswresample.html
│   │   ├── libswscale.html
│   │   ├── mailing-list-faq.html
│   │   ├── nut.html
│   │   ├── platform.html
│   │   └── style.min.css
│   ├── LICENSE.txt
│   └── man
│       ├── man1
│       │   ├── ffmpeg.1
│       │   ├── ffmpeg-all.1
│       │   ├── ffmpeg-bitstream-filters.1
│       │   ├── ffmpeg-codecs.1
│       │   ├── ffmpeg-devices.1
│       │   ├── ffmpeg-filters.1
│       │   ├── ffmpeg-formats.1
│       │   ├── ffmpeg-protocols.1
│       │   ├── ffmpeg-resampler.1
│       │   ├── ffmpeg-scaler.1
│       │   ├── ffmpeg-utils.1
│       │   ├── ffplay.1
│       │   ├── ffplay-all.1
│       │   ├── ffprobe.1
│       │   └── ffprobe-all.1
│       └── man3
│           ├── libavcodec.3
│           ├── libavdevice.3
│           ├── libavfilter.3
│           ├── libavformat.3
│           ├── libavutil.3
│           ├── libswresample.3
│           └── libswscale.3
├── ffmpeg-master-latest-linux64-gpl.tar.xz
├── install_dependencies.sh
├── LICENSE
├── music
│   └── 左手指月.webm
├── newversion.sh
├── pdm.lock
├── pyproject.toml
├── README.md
├── requirements.txt
├── update-requirements.sh
├── xiaomusic
│   ├── cli.py
│   ├── config.py
│   ├── httpserver.py
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── cli.cpython-311.pyc
│   │   ├── config.cpython-311.pyc
│   │   ├── httpserver.cpython-311.pyc
│   │   ├── __init__.cpython-311.pyc
│   │   ├── utils.cpython-311.pyc
│   │   └── xiaomusic.cpython-311.pyc
│   ├── static
│   │   ├── app.js
│   │   ├── index.html
│   │   └── jquery-3.7.1.min.js
│   ├── utils.py
│   └── xiaomusic.py
└── xiaomusic.py
hanxi commented 5 months ago

可能是路径问题,我代码里写的是相对路径

https://github.com/hanxi/xiaomusic/blob/main/xiaomusic/xiaomusic.py#L312

你改成绝对路径试试,或者用cwd打印看看当前路径是什么?

hanxi commented 5 months ago

看看你是在哪个目录执行启动命令的?

ansemz commented 5 months ago

你看我的tree结果,ffmpeg就是在相对路径的位置。我也先改成绝对路径试试

ansemz commented 5 months ago

改成绝对路径/usr/local/bin就可以了。

ansemz commented 5 months ago

看看你是在哪个目录执行启动命令的?

项目根目录

$ ls
Dockerfile                               newversion.sh
LICENSE                                  pdm.lock
README.md                                pyproject.toml
ffmpeg/                                  requirements.txt
ffmpeg-master-latest-linux64-gpl.tar.xz  update-requirements.sh
install_dependencies.sh                  xiaomusic/
music/                                   xiaomusic.py

$ pdm run xiaomusic.py
INFO: Inside an active virtualenv /path/to/venvs/xiaomi-py311, reusing it.
Set env var PDM_IGNORE_ACTIVE_VENV to ignore it.
[02/06/24 11:46:55] INFO     Serving on 0.0.0.0:8090                                        httpserver.py:74
                    INFO     Running xiaomusic now,                                         xiaomusic.py:394
                             用`播放歌曲/放歌曲/下一首/单曲循环/全部循环/随机播放/关机/停止                 
                             播放/分钟后关机/set_volume#`开头来控制                                         
 * Serving Flask app 'xiaomusic.httpserver'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:8090
 * Running on http://192.168.18.142:8090
Press CTRL+C to quit
ansemz commented 5 months ago

又试了一下,直接把ffmpeg的那两行注释也行,就直接调用系统路径下面的ffmpeg了。

hanxi commented 4 months ago

@ansemz 已经支持配置 ffmpeg 路径,有空可以测测。

ansemz commented 4 months ago

@hanxi 命令行参数指定路径以后,可以正常转换了,一切正常。感谢。

@ansemz 已经支持配置 ffmpeg 路径,有空可以测测。