R
Railway•3mo ago
js3n

FastAPI ffmpeg issue

I'm getting this error only in the railway. I have move the docker image to vultr for temporarily with 1 vcpu and 4GB memory, it's works fine. issue is I'm getting this error: failed to read the first frame of video file /user/app/utils/outputs/314828046836138453768962165010375030174.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Please update to a recent version from the website.
46 Replies
Percy
Percy•3mo ago
Project ID: 0d667724-67ef-4a76-8014-e43d46da63ce
js3n
js3n•3mo ago
0d667724-67ef-4a76-8014-e43d46da63ce
Brody
Brody•3mo ago
how are you currently installing ffmpeg into your deployment
js3n
js3n•3mo ago
via Dockerfile : COPY ffmpeg/ffmpeg /usr/local/bin/ RUN chmod +x /usr/local/bin/ffmpeg
Brody
Brody•3mo ago
please send your full dockerfile
js3n
js3n•3mo ago
Brody
Brody•3mo ago
you are copying a local ffmpeg binary into the image, that's rarely a good idea, instead install it via apt or with whatever install method ffmpeg recommends
js3n
js3n•3mo ago
previously I have done that, but issue is same with that too 😦
Brody
Brody•3mo ago
lets go back to the correct way to install ffmpeg and work from there
js3n
js3n•3mo ago
same issue : VideoFileClip: MoviePy error: failed to read the first frame of video file /vimzy/app/utils/outputs/31299644617729035779466999651352153414.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Please update to a recent version from the website.
Brody
Brody•3mo ago
okay let's see your new dockerfile
js3n
js3n•3mo ago
Brody
Brody•3mo ago
what version of ffmpeg does that install
js3n
js3n•3mo ago
it should install latest version
Brody
Brody•3mo ago
can you check that for me
js3n
js3n•3mo ago
4.2.2
Brody
Brody•3mo ago
cool, how did you go about getting that version
js3n
js3n•3mo ago
i added this line : print("ffmpeg :", moviepy.config.FFMPEG_BINARY)
Brody
Brody•3mo ago
what exactly did that print
js3n
js3n•3mo ago
/usr/local/lib/python3.10/dist-packages/imageio_ffmpeg/binaries/ffmpeg-linux64-v4.2.2
Brody
Brody•3mo ago
that looks like ffmpeg that a python module in trying to install, and not the ffmpeg that apt is installing, that can cause problems I would recommend removing the python module that is trying to install it's own ffmpeg
js3n
js3n•3mo ago
okay 🙂 I have used RUN apt install -y ffmpeg and still install to the python package. issue is my local pc and vultr is working fine ( runing same docker file ) and railway is the only issue. Also I notice that My function using 30 video clips to load ( 2 - 3 seconds ) then it will give this error and if I load 5 videos it's works fine
Brody
Brody•3mo ago
please prevent the python module from installing ffmpeg
js3n
js3n•3mo ago
I have remove the python package and used /usr/bin/ffmpeg with apt install but still having the same issue 😦
Brody
Brody•3mo ago
what version is in use now?
js3n
js3n•3mo ago
I have tested it ubuntu 22.04 LTS server and works fine. I think i have to migrate for that option 😦 4.2.2 🙂
Brody
Brody•3mo ago
i have seen plenty of people use ffmpeg on railway without issues, after they stopped installing it via a dependency, so while that may not be the root issue, its good that we stopped doing that. whats the current path to ffmpeg now?
js3n
js3n•3mo ago
/user/bin/ffmpeg new path 🙂
Brody
Brody•3mo ago
okay great, so you said something about it working fine when you process only 5 videos?
js3n
js3n•3mo ago
yeah 🙂 it's works without the error, but when load 30 videos ( 2 - 3 seconds ) it gives the error 😦
Brody
Brody•3mo ago
now hearing that, it makes me think you are running into resource limitations
js3n
js3n•3mo ago
but I'm using it on a 4gb ram 2 cpu vps 😦
Brody
Brody•3mo ago
docker is completely different, a vps has hard physical limits even though the metrics on railway might now tell the story I expect, can you still show me them when you try to load 30 videos?
js3n
js3n•3mo ago
No description
Brody
Brody•3mo ago
oh, you're on pro
js3n
js3n•3mo ago
yes 🙂
Brody
Brody•3mo ago
hmmm, could there still be spikes up to 32gb + that are causing inconsistencies or how are these 30 video files making it into your app to begin with?
js3n
js3n•3mo ago
they are geting download from a external source 🙂
Brody
Brody•3mo ago
I'm genuinely stumped
js3n
js3n•3mo ago
Can you report this to the railway? Thanks for the help 🙂
Brody
Brody•3mo ago
i will mark this thread as private -> https://help.railway.app/questions/fast-api-ffmpeg-issue-fd7ea729 the team will then respond there, i will also lose access to it, so keep me updated in this discord thread please. update for team, they are now using ffmpeg installed via apt done through their dockerfile.
js3n
js3n•3mo ago
Thank you for the support, I will update 🙂
Brody
Brody•3mo ago
thanks!
Duchess
Duchess•3mo ago
New reply sent from Help Station thread:
(hidden)
You're seeing this because this thread has been automatically linked to the Help Station thread. New reply sent from Help Station thread:
(hidden)
You're seeing this because this thread has been automatically linked to the Help Station thread. New reply sent from Help Station thread:
(hidden)
You're seeing this because this thread has been automatically linked to the Help Station thread. New reply sent from Help Station thread:
(hidden)
You're seeing this because this thread has been automatically linked to the Help Station thread. New reply sent from Help Station thread:
(hidden)
You're seeing this because this thread has been automatically linked to the Help Station thread. New reply sent from Help Station thread:
(hidden)
You're seeing this because this thread has been automatically linked to the Help Station thread. New reply sent from Help Station thread:
(hidden)
You're seeing this because this thread has been automatically linked to the Help Station thread.
Brody
Brody•3mo ago
any progress?
Duchess
Duchess•3mo ago
New reply sent from Help Station thread:
(hidden)
You're seeing this because this thread has been automatically linked to the Help Station thread.