Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker support #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
.gitignore
LICENSE
README.md
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:16.04

WORKDIR /low-latency-preview

RUN apt-get update && apt-get install -y software-properties-common python-software-properties
COPY installDeps.sh .
RUN chmod +x installDeps.sh
RUN ./installDeps.sh

COPY . .
RUN chmod +x *.sh
RUN ./buildEncoderAndServerForUbuntu.sh --no-deps

EXPOSE 8080

ENTRYPOINT ["/bin/bash"]

25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Run...

git clone https://github.com/colleenkhenry/low-latency-preview.git

Run...
Run...

cd low-latency-preview

Expand All @@ -46,7 +46,7 @@ To run the encoder

./launchEncoderTestPattern.sh *insert destination hostname of server* *insert a stream name*

Example:
Example:

./launchEncoderTestPattern.sh localhost 1234

Expand All @@ -63,6 +63,27 @@ To kill the streams

You can modify the FFmpeg encoding settings to taste for resolution, inputs, etc.

### How to run using docker (OSX/Windows)
#### Build docker image
```docker build -t low-latency-preview .```

#### Run the server
```docker run -d -p 8080:8080 low-latency-preview launchServer.sh```

#### Run the encoder
In OSX:

```docker run -d low-latency-preview launchEncoderTestPattern.sh docker.for.mac.localhost 1234```

In Linux:

```docker run -d low-latency-preview launchEncoderTestPattern.sh localhost 1234```

Note for mac: There is a known bug in docker for mac that causes docker containers time to be out of sync with osx host (https://github.com/docker/for-mac/issues/1260). That's specially annoying when working with mpeg-dash streams, that requires a good time synchronization so all timing calculations are correct. To fix this issue you have to run the following command before launching any of the previous containers (server/encoder):

```docker run --rm --privileged alpine hwclock -s```


We are using the dash.js player. Feel free to visit http://reference.dashif.org/dash.js/nightly/samples/dash-if-reference-player/index.html for their nightly referencep player or their github at https://github.com/Dash-Industry-Forum/dash.js/wiki.

Help wanted :)
Expand Down
41 changes: 5 additions & 36 deletions buildEncoderAndServerForUbuntu.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,14 @@
#!/bin/bash

# instlal go repo

sudo add-apt-repository -y ppa:longsleep/golang-backports

# update the OS

sudo apt-get -y update

sudo apt-get -y upgrade

sudo apt-get install -y yasm libx264-dev libfreetype6-dev golang-go libass-dev pkg-config texinfo build-essential automake autoconf libssl-dev
# By default install dependencies
if [ $1 != "--no-deps" ]; then
./installDeps.sh
fi

export GOPATH=$HOME/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

go get -d -v .

go build

mkdir www logs

# Download and compile FFmpeg

rm -r -f ffmpeg/

git clone http://github.com/FFmpeg/ffmpeg.git -b master

cd ffmpeg

# Configure FFmpeg build

./configure \
--enable-gpl \
--enable-libass \
--enable-libx264 \
--enable-nonfree \
--enable-openssl \
--enable-libfreetype

# Build ffmpeg

make

cd ..
mkdir -p www logs
44 changes: 44 additions & 0 deletions installDeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Use sudo only if not using root

sudo ()
{
[[ $EUID = 0 ]] || set -- command sudo "$@"
"$@"
}

# install go repo

sudo add-apt-repository -y ppa:longsleep/golang-backports

# update the OS

sudo apt-get -y update

sudo apt-get -y upgrade
sudo apt-get install -y git yasm libx264-dev libfreetype6-dev golang-go libass-dev pkg-config texinfo build-essential automake autoconf libssl-dev software-properties-common python-software-properties git

# Download and compile FFmpeg

rm -r -f ffmpeg/

git clone http://github.com/FFmpeg/ffmpeg.git -b master

cd ffmpeg

# Configure FFmpeg build

./configure \
--enable-gpl \
--enable-libass \
--enable-libx264 \
--enable-nonfree \
--enable-openssl \
--enable-libfreetype

# Build ffmpeg

make

cd ..
2 changes: 1 addition & 1 deletion launchEncoderTestPattern.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ ffmpeg/ffmpeg \
-remove_at_exit 1 \
-adaptation_sets "id=0,streams=v id=1,streams=a" \
-f dash \
http://${1}:8080/ldash/${2}/manifest.mpd >/dev/null 2>logs/encode.log &
http://${1}:8080/ldash/${2}/manifest.mpd >/dev/null 2>logs/encode.log