How to add ffmpeg in a flask - python project on railway?

Hi, i have the next issue: I like to process an audio (type bytes) and I have this error: warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) anybody know how to fix it?
5 Replies
Brody
Brody•9mo ago
add a nixpacks.toml file with this in it to your project
[phases.setup]
nixPkgs = ['...', 'ffmpeg']
[phases.setup]
nixPkgs = ['...', 'ffmpeg']
Giloh
Giloh•8mo ago
Thank you for helping on this ! Now ffmpeg seems to be correctly installed. However I'm getting this error : "json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)" According to this : https://github.com/jiaaro/pydub/issues/450 It is caused by having a customize output location for ffmpeg which Pydub does not expect. I think there is a way to point to Pydub where is installed ffmpeg. Do you have any idea where ffmpeg could be installed ? Maybe I could find it using CLI but am very new to railway and I'm not sure how to use it 🙂 Thank youu
GitHub
Open File with JSONDecodeError · Issue #450 · jiaaro/pydub
Expected behavior open a mp3 with no error Actual behavior I used the script below: from pydub import AudioSegment song = AudioSegment.from_mp3(r"test2.mp3") and there is a JSONDecodeErro...
Brody
Brody•8mo ago
ffmpeg would be installed somewhere in one of the folders listed in the PATH environment variable, if the library can't pick this up then it's a problem with the library and it would likely be much easier to use a library with no such issues
Giloh
Giloh•8mo ago
Ok then ! thank you for answering I solved the issue using this instead in the nixpacks.toml file: [phases.setup] nixPkgs = ["...", "jellyfin-ffmpeg"]
Brody
Brody•8mo ago
well that's certainly an odd fix