-
-
Save willmasters/382fe6caba44a4345a3de95d98d3aae5 to your computer and use it in GitHub Desktop.
Updated 2025-01-17 thanks to Yemster's comment. | |
This should work on any architecture of Amazon Linux 2. | |
(_Although not tested , should also work for Amazon Linux 2023_). | |
**Prereq** | |
- visit https://johnvansickle.com/ffmpeg/ to grab the link to the relevant tarball for your specific server architecture. | |
- Use `uname -a` to find out your arch if unknown | |
### TL;DR | |
```shell | |
mkdir ~/sources && cd ~/sources | |
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz | |
tar -xvf ffmpeg-release-arm64-static.tar.xz | |
cd ffmpeg-*-arm64-static | |
sudo mv ffmpeg /usr/local/bin/ | |
sudo mv ffprobe /usr/local/bin/ | |
# confirm it's working | |
ffmpeg -version | |
``` | |
### The details - for those who need more info | |
```shell | |
# Create/use a temporary working directory | |
mkdir ~/sources && cd ~/sources | |
# Download tarball | |
# => Visit https://johnvansickle.com/ffmpeg/ to see list of available builds per arch & distros | |
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz | |
# extract tarball | |
tar -xvf ffmpeg-release-arm64-static.tar.xz | |
cd ffmpeg-*-arm64-static | |
# *** you may want to test to confirm it works *** | |
./ffmpeg -version # should see something like: `ffmpeg version 7.0.2-static` on first line | |
# relocate to system path | |
sudo mv ffmpeg /usr/local/bin/ | |
sudo mv ffprobe /usr/local/bin/ | |
# confirm it's working | |
ffmpeg -version # => ffmpeg version 7.0.2-static | |
# cleanup - optional | |
cd ~/ && rm -rf ~/sources/ffmpeg-* | |
``` |
Unfortunately, as ffmpeg is updated, the folder name inside the downloaded archive will change. This script is sadly useless for any sort of automated provisioning.
You may want to choose one of the older versions shown here, and hope they're not deleted over time. https://www.johnvansickle.com/ffmpeg/old-releases/
thanks man it saved my ass...
for more newbies like me stumbling upon this please take care of editing script as following
1.) use new link specified in above comment and run line 9,10 accordingly to new link
2.) before executing line 11 , check existing directories ( run ls ) first to see whats the name of static ffmpeg folder by which it is saved,
(in my case it was ffmpeg-4.2.2-amd64-static ) ,then run line 11 accordingly.
Version: AWS EC2 Linux Instance x86_64 Node.js:
A few things that I needed to change. This was the most helpful article I have seen from numerous google searches to date.
1.) Changed tar xvf ffmpeg-X.X.X-amd64-static.tar.xz to tar -xf ffmpeg-X.X.X-amd64-static.tar.xz (fill in X.X.X with your static build version)
2.) Because I didn't get it right the first time, or second, etc. I believe I needed to override the symbolic link originally created? I added the command to do just that and now its working. ln -sfn /usr/local/bin/ffmpeg/ffmpeg /usr/bin/ffmpeg
Thank you for this. Why doesn't Amazon Linux provide this via a package manager like yum in amazon-linux-extras or epel? Is epel just for CentOS?
facing error while using ffmpeg
Input model at /usr/local/share/model/vmaf_v0.6.1.pkl cannot be read successfully.
Caught VmafException: Error loading model (.pkl): Trouble reading the file:/usr/local/share/model/vmaf_v0.6.1.pkl
[Parsed_libvmaf_0 @ 0x5d5aec0] libvmaf encountered an error, check log for details
Error while filtering: Invalid argument
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!
Can someone help in this ?
Not here no. Perhaps ask in https://github.com/FFmpeg/
Use this, I modified this to fit our needs
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
mkdir ffmpeg-release-amd64-static
tar -xf ffmpeg-release-amd64-static.tar.xz --strip-components=1 -C ffmpeg-release-amd64-static
rm -f ffmpeg-release-amd64-static.tar.xz
ln -s /root/ffmpeg-release-amd64-static/ffmpeg /usr/local/bin/ffmpeg
Nice find @RichardTMiles
Although I installed it @RichardTMiles way, it won't work with my php script.
Checked the script; everything seems to be ok.
@oharaandrew314 with the asterisk '*' you can get around the issue with varying version number
if [ ! -f /usr/local/bin/ffmpeg ]
then
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
tar xvf ffmpeg-release-amd64-static.tar.xz
mv ffmpeg-*-amd64-static/ff* /usr/local/bin/
fi
Thanks!
I am following @RichardTMiles but getting following error while building my docker file for aws lambda. I see the filename is correct though.
Step 8/17 : RUN mkdir ffmpeg-release-amd64-static
---> Running in 83ef215b8ad1
Removing intermediate container 83ef215b8ad1
---> d99b1fe0ce57
Step 9/17 : RUN tar -xf ffmpeg-release-amd64-static.tar.xz --strip-components=1 -C ffmpeg-release-amd64-static
---> Running in 882c2087ead9
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
The command '/bin/sh -c tar -xf ffmpeg-release-amd64-static.tar.xz --strip-components=1 -C ffmpeg-release-amd64-static' returned a non-zero code: 2
[Container] 2023/01/23 13:30:24 Command did not exit successfully docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG . exit status 2
@akayalml Amazon Linux 2 doesn't have xz
installed by default. You need to run yum install xz
and tar -xf
will work properly
Amazon Linux 2023 is out; one should upgrade as often as possible.
$ wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
$ tar -xjvf ffmpeg-snapshot.tar.bz2
$ cd ffmpeg
$ ./configure
$ make
$ sudo make install
$ ffmpeg -version
This worked for me in 2024, Amazon Linux 2
@Rudrabha your steps also work with AL2023, thanks!
I am using https://ffmpeg.org/releases/ffmpeg-7.0.tar.bz2
instead of the snapshot (which I believe is nightly?)
@Rudrabha Amazon Linux 2 is EOL and should not be used.
@RichardTMiles "Amazon Linux 2 end of support date (End of Life, or EOL) has been extended by two years from 2023-06-30 to 2025-06-30 to provide customers with ample time to migrate to the next version."
Noted @stevebanik, thanks. I’ll reiterate that everyone should be upgrading regularly. Avoiding inevitably is a poor decision IMHO. Get the latest and greatest from the newest versions. Support will end, and if you wait until the last minute you will be left insecure. It is MUCH easier to upgrade immediately as new major releases happen. Jumping 2-3 major versions is generally not a good time.
Solution May 2024
Given that nobody wants to post their solution, I figured I will :)
.ebextensions/ffmpeg.config
sources:
/usr/local/bin/ffmpeg: https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
commands:
01_link_ffmpeg:
command: ln -sf /usr/local/bin/ffmpeg/ffmpeg*/ffmpeg /usr/bin/ffmpeg
My initial attempt was to only use Linux commands like wget and tar to download and extract the archive. However, running tar command would froze machine each time I ran it. The above works though without any issues.
@VladimirMikulic pretty cool, however this solution still relies on the remote server. I was in a situation where a public server for some package went down couple of times, disrupting deployments. For more "sensitive" projects I'd recommend periodically caching the file on your S3 bucket and using this solution:
commands:
install_ffmpeg:
command: |
if [ ! -e /usr/bin/ffmpeg ]
then
aws s3 cp s3://YOUR_BUCKET/ffmpeg-release-amd64-static.tar.xz ffmpeg-release-amd64-static.tar.xz
mkdir -p /usr/local
tar xf ffmpeg-release-amd64-static.tar.xz -C /usr/local
ln -sf /usr/local/ffmpeg-6.0-amd64-static/ffmpeg /usr/bin/ffmpeg
ln -sf /usr/local/ffmpeg-6.0-amd64-static/ffprobe /usr/bin/ffprobe
fi
You still have to download and upload the release file to S3, but it shouldn't be a big deal if you do it 2-3 times a year or have another CI/CD task to do it for you once a week.
@januszm thanks for the code snippet but tar is not an option for me since it frozes the machine unfortunately :)
I followed this medium post for install ffmpeg installation in Amazon Linux.
Link: Click here for link
@rajaduraicloud hey it’s better form to post what specifically was needed that worked for you, with a delta of what was given above. Links can changes, sites can go down, but a real comment with real code is written to last. I personally am not seeing any difference in the medium article and the code suggested above?
@januszm thanks for the code snippet but tar is not an option for me since it frozes the machine unfortunately :)
I think you can upload unpacked archive to S3 and therefore won't need to run tar
.
How can I add this Video Codec av1 also - SVT-AV1
Above packages has this missing.
Will SVT-AV1 work in Amazon Linux or I must use Ubuntu
@samcurran22 you will quickly find yourself in dependency hell trying to install svt-av1 packages. I would suggest using Google Colab (Ubuntu 22.04.5 LTS) to test, if you're brave. 2 cores, 12GB RAM, 100GB SSD, all for free!
In case helpful, this worked for me.
I opted for prebuilt for speed and peace of mind - this should work on any architecture of Amazon Linux 2.
(Although not tested , should also work for Amazon Linux 2023).
Prereq
- visit https://johnvansickle.com/ffmpeg/ to grab the link to the relevant tarball for your specific server architecture.
- Use
uname -a
to find out your arch if unknown
TL;DR
mkdir ~/sources && cd ~/sources
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz
tar -xvf ffmpeg-release-arm64-static.tar.xz
cd ffmpeg-*-arm64-static
sudo mv ffmpeg /usr/local/bin/
sudo mv ffprobe /usr/local/bin/
# confirm it's working
ffmpeg -version
The details - for those who need more info
# Create/use a temporary working directory
mkdir ~/sources && cd ~/sources
# Download tarball
# => Visit https://johnvansickle.com/ffmpeg/ to see list of available builds per arch & distros
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz
# extract tarball
tar -xvf ffmpeg-release-arm64-static.tar.xz
cd ffmpeg-*-arm64-static
# *** you may want to test to confirm it works ***
./ffmpeg -version # should see something like: `ffmpeg version 7.0.2-static` on first line
# relocate to system path
sudo mv ffmpeg /usr/local/bin/
sudo mv ffprobe /usr/local/bin/
# confirm it's working
ffmpeg -version # => ffmpeg version 7.0.2-static
# cleanup - optional
cd ~/ && rm -rf ~/sources/ffmpeg-*
RE automated provisioning
This solution should work with automated provisioning as well or easy enough to adapt to specific needs.
It uses the latest stable package at the endpoint and does not rely on knowing the strictly version specifically named folder of the extracted tarball i.e. cd ffmpeg-*-arm64-static
.
In case helpful, this worked for me.
Thanks for sharing - I have updated the gist to your comment. As people seem to find their way here.
The link is changed https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz