Issue
I have a Spring-boot project, where I am using the ffmpeg library, I am executing the ffmpeg commands through a ProcessBuilder(in the terminal/cmd) and everything works fine, because I have already installed the ffmpeg on my macOS. When I try to generate a jar and run it on an another machine, where ffmpeg is not installed, it is executed, everything works fine, except the ffmpeg comamnds. Is there any change to import the library to my maven project or somehow to use it? Is it a good idea to add an external jar of the library?
Thank you in advance!
Solution
Is the server you're deploying to Mac (same as your desktop) or Windows/Linux? The reason I ask is because ffmpeg is a binary app and has to be compiled to the specific platform.
You could include ffmpeg in maven, but before it runs it will need to be compiled. I found one maven repository here, though I do not know how well this will work: https://mvnrepository.com/artifact/com.tagtraum/ffmpeg/4.0.0. You could also try compiling from source (particularly if there's some non-standard encoding/decoding you're trying to do), which is a much more involved installation.
What I would do is install ffmpeg through a separate installation package, ideally through the OS's package management system; for linux this would be something like:
(Ubuntu)
sudo apt-get install ffmpeg
(CentOS)
sudo yum install epel-release
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
sudo yum install ffmpeg ffmpeg-devel
More info on installation here: https://www.ostechnix.com/install-ffmpeg-linux/
Sometimes these packages may be not be the latest or missing something you're trying to do, in which case you may need to compile from source.
Edit: You say you're using Windows. I'm not as familiar with deploying to Windows, but there are ffmpeg Windows packages available on this site (linked from the main ffmpeg page): https://ffmpeg.zeranoe.com/builds/ . I recommend installing separately rather than trying to package with your Java app. This page can help: https://windowsloop.com/install-ffmpeg-windows-10/
Answered By - Steve