How to add ffmpeg to Travis?

In order to test Plots.jlgif creation in Travis, i.e. something like this:

using Base.Test, Plots
anim = @animate for i=1:2
    plot(rand(2))
end
name = tempname()*".gif"
gif(anim, name)
@test isfile(name)

we have to somehow add ffmpeg as a dependency (e.g. in the .travis.yml file, or via BinDeps.jl). Does anyone know exactly how this is done?

Does adding something like

before_install:
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media/+files/ffmpeg_3.3.3~trusty2_amd64.deb ; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo dpkg -i ffmpeg_3.3.3~trusty2_amd64.deb ; fi

in travis.yml work?
Note that this is just a guess based on how Plots.jl installs wkhtmltox on travis for the tests. (See https://github.com/JuliaPlots/Plots.jl/blob/master/.travis.yml#L21 and https://github.com/JuliaPlots/Plots.jl/blob/master/test/install_wkhtmltoimage.sh)

1 Like

Interesting. But I got this error:

removed ‘/etc/apt/sources.list.d/basho_riak.list’
W: http://ppa.launchpad.net/couchdb/stable/ubuntu/dists/trusty/Release.gpg: Signature by key 15866BAFD9BCC4F3C1E0DFC7D69548E1C17EAB57 uses weak digest algorithm (SHA1)
W: Failed to fetch https://packagecloud.io/computology/apt-backport/ubuntu/dists/trusty/InRelease  Failed to connect to packagecloud.io port 443: Connection timed out
W: Failed to fetch https://packagecloud.io/github/git-lfs/ubuntu/dists/trusty/InRelease  Failed to connect to packagecloud.io port 443: Connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

I’ll see if I also can make a small bash file for ffmpeg, but how would one solve this for the mac Travis?

You could also try something like

sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg

in the bash file. I have no idea about mac though.

1 Like

Fixed! Thanks @daschw!!!
I ended up using this:

#!/bin/sh

sudo add-apt-repository -y ppa:mc3man/trusty-media
sudo apt-get -qq update
sudo apt-get install -y ffmpeg

Awesome!

Am I to understand from this that Plots.jl is not supported on macs? :scream:

This has been that way before I joind the JuliaPlots team - not sure why… I will take a look at what the issue with travis on mac is.

1 Like

I guess part of the problem is the installation of ffmpeg.

This line in .travis.yml finally solved it:

  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ffmpeg cairo; fi
1 Like