Skip to content

HOME » Build » Docker

This page contains instructions on how to build and use gpac with Docker.

For now, only linux containers are available.

Pre-requisite: a working Docker installation.

Linux

We provide two types of resources depending on your use case.

  1. A Dockerfile if you want to build your own image
  2. A Docker Hub image if you only want to use gpac

Build your own image (optional)

# clone gpac repo

git clone https://github.com/gpac/gpac.git
cd gpac

# make changes or checkout a specific branch or commit you want 
... 

# doubly optional: you can change and rebuild the base system containing the dependencies for gpac with
docker build -t gpac/ubuntu-deps -f build/docker/ubuntu-deps.Dockerfile .

# build the docker image
docker build -t myimages/gpac -f build/docker/ubuntu.Dockerfile .

Use an image

You can either use your own image if you built it (see section above), or use pre-built images from Docker Hub.

To get a pre-build image, use:

docker pull gpac/ubuntu

You can use the gpac image a number of way.

Get the build artifacts

The image contains binaries for:
- a minimal statically linked executable for MP4Box and gpac CLI tools
- deb packages for the OS used in the image (ubuntu-latest as defined on the ubuntu dockerhub page)

You can use these binaries on your host OS if it is relevant.

You can extract these binaries with

$ docker create --name dummy gpac/ubuntu
$ docker cp dummy:/gpac/binaries .
$ docker rm dummy

$ ls -1 binaries/

gpac
gpac_2.3-DEV-rev351-gba47abf5a-docker_amd64.deb
libgpac-dev_2.3-DEV-rev351-gba47abf5a-docker_amd64.deb
libgpac_static.a
MP4Box


$ ./binaries/gpac

Refreshing all options registry, this may take some time ... done
gpac - GPAC command line filter engine - version 2.3-DEV-rev351-gba47abf5a-docker
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io
        MINI build (encoders, decoders, audio and video output disabled)

Please cite our work in your research:
        GPAC Filters: https://doi.org/10.1145/3339825.3394929
        GPAC: https://doi.org/10.1145/1291233.1291452

Run gpac inside of container

Once you have a gpac image, you can run commands directly inside of a container.

Examples:

$ docker run --rm gpac/ubuntu MP4Box -version

[core] Creating default credential key in /root/.gpac/creds.key, use -cred=PATH/TO_FILE to overwrite
MP4Box - GPAC version 2.3-DEV-rev345-gc7c404d8f-master
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io

Please cite our work in your research:
        GPAC Filters: https://doi.org/10.1145/3339825.3394929
        GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: --host=x86_64-linux-gnu --prefix=/usr --build=x86_64-linux-gnu --extra-cflags=-Wall -g -fPIC -DPIC --cc=ccache cc CXX=ccache g++
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_FAAD GPAC_HAS_MAD GPAC_HAS_LIBA52 GPAC_HAS_JPEG GPAC_HAS_PNG GPAC_HAS_FFMPEG GPAC_HAS_OPENSVC GPAC_HAS_OPENHEVC GPAC_HAS_THEORA GPAC_HAS_VORBIS GPAC_HAS_LINUX_DVB  


$ docker run --rm gpac/ubuntu gpac -i http://download.tsi.telecom-paristech.fr/gpac/gpac_test_suite/mp4/counter_video_360.mp4 inspect

[core] Creating default credential key in /root/.gpac/creds.key, use -cred=PATH/TO_FILE to overwrite
Refreshing all options registry, this may take some time ... done
PID 1 video duration 10:00.000 timescale 25000 640x360 fps 25 SAR 1/1 193 kbps 15000 frames codec avc1.42C01E AVC|H264 PL Baseline@3 YUV 4:2:0 8 bpp



# map a local folder to the container to read/write
$ docker run --rm -v ./vids:/vids gpac/ubuntu gpac -i /vids/counter_video_360.mp4 -o /vids/test.mpd
$ cat vids/test.mpd

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 2.3-DEV-rev345-gc7c404d8f-master at 2023-06-14T14:22:59.640Z -->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.000S" type="static" mediaPresentationDuration="PT0H10M0.000S" maxSegmentDuration="PT0H0M1.000S" profiles="urn:mpeg:dash:profile:full:2011">
 <ProgramInformation moreInformationURL="http://gpac.io">
  <Title>test.mpd generated by GPAC</Title>
 </ProgramInformation>

 <Period duration="PT0H10M0.000S">
  <AdaptationSet segmentAlignment="true" maxWidth="640" maxHeight="360" maxFrameRate="25" par="16:9" startWithSAP="1">
   <SegmentTemplate media="counter_video_360_dash$Number$.m4s" initialization="counter_video_360_dashinit.mp4" timescale="25000" startNumber="1" duration="25000"/>
   <Representation id="1" mimeType="video/mp4" codecs="avc1.42C01E" width="640" height="360" frameRate="25" sar="1:1" bandwidth="193112">
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

Use a container as a dev or runtime environement

Finally you can simply run a container and use it as an environement where you can run gpac commands, modify and build gpac, or develop programs built again libgpac.

$ docker run -it gpac/ubuntu bash

root@6610e278322e:/gpac/gpac_public# make distclean && ./configure --enable-debug && make -j && make install
root@6610e278322e:/gpac/gpac_public# MP4Box -version

MP4Box - GPAC version 2.3-DEV-rev351-gba47abf5a-docker
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io

Please cite our work in your research:
        GPAC Filters: https://doi.org/10.1145/3339825.3394929
        GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: --enable-debug
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_FAAD GPAC_HAS_MAD GPAC_HAS_LIBA52 GPAC_HAS_JPEG GPAC_HAS_PNG GPAC_HAS_FFMPEG GPAC_HAS_OPENSVC GPAC_HAS_OPENHEVC GPAC_HAS_THEORA GPAC_HAS_VORBIS GPAC_HAS_LINUX_DVB   

Was this page helpful?