# How to add ffmpeg to Travis?

**URL:** https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366
**Category:** Visualization
**Tags:** question, plotting, travis
**Created:** [February 27, 2018, 2:29pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366 "2018-02-27T14:29:17Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [February 27, 2018, 2:29pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/1 "2018-02-27T14:29:17Z")

</div>

In order to test `Plots.jl`’ `gif` creation in Travis, i.e. something like this:

```julia
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?**

---

<div class="post-metadata">

### Author: ![daschw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daschw/32/2926_2.png) [@daschw](https://discourse.julialang.org/u/daschw)
#### Post date: [February 27, 2018, 2:53pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/2 "2018-02-27T14:53:08Z")

</div>

Does adding something like

```julia
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](https://github.com/JuliaPlots/Plots.jl/blob/master/.travis.yml#L21) and [https://github.com/JuliaPlots/Plots.jl/blob/master/test/install\_wkhtmltoimage.sh](https://github.com/JuliaPlots/Plots.jl/blob/master/test/install_wkhtmltoimage.sh))

---

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [February 27, 2018, 3:03pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/3 "2018-02-27T15:03:10Z")

</div>

Interesting. But I got this error:

```julia
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?

---

<div class="post-metadata">

### Author: ![daschw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daschw/32/2926_2.png) [@daschw](https://discourse.julialang.org/u/daschw)
#### Post date: [February 27, 2018, 3:13pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/4 "2018-02-27T15:13:56Z")

</div>

You could also try something like

```julia
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.

---

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [February 27, 2018, 3:38pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/5 "2018-02-27T15:38:20Z")

</div>

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

```bash
#!/bin/sh

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

```

---

<div class="post-metadata">

### Author: ![daschw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daschw/32/2926_2.png) [@daschw](https://discourse.julialang.org/u/daschw)
#### Post date: [February 27, 2018, 3:40pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/6 "2018-02-27T15:40:00Z")

</div>

Awesome!

---

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [February 27, 2018, 3:47pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/7 "2018-02-27T15:47:31Z")

</div>

Am I to understand from [this](https://github.com/JuliaPlots/Plots.jl/blob/master/.travis.yml#L5) that `Plots.jl` is not supported on macs? 😱

---

<div class="post-metadata">

### Author: ![daschw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daschw/32/2926_2.png) [@daschw](https://discourse.julialang.org/u/daschw)
#### Post date: [February 27, 2018, 3:58pm UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/8 "2018-02-27T15:58:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [March 6, 2018, 9:14am UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/9 "2018-03-06T09:14:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [March 6, 2018, 10:19am UTC](https://discourse.julialang.org/t/how-to-add-ffmpeg-to-travis/9366/10 "2018-03-06T10:19:39Z")

</div>

This line in `.travis.yml` finally solved it:

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

```
