This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
304 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: [V2] | ||
|
||
jobs: | ||
buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build image and push to GitHub Container Registry | ||
uses: docker/build-push-action@v3 | ||
with: | ||
cache: cache | ||
push: true | ||
tags: ghcr.io/denizugur/capsc:latest | ||
|
||
- name: Inspect image | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# Build OpenCV | ||
FROM ubuntu:xenial AS ffmpeg-builder | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Update apt cache | ||
RUN apt-get update | ||
|
||
# Install dependencies | ||
RUN apt-get --no-install-recommends -y remove ffmpeg x264 libx264-dev | ||
RUN apt-get --no-install-recommends -y install libopencv-dev | ||
RUN apt-get --no-install-recommends -y install build-essential checkinstall cmake pkg-config yasm | ||
RUN apt-get --no-install-recommends -y install libtiff5-dev libjpeg-dev libjasper-dev | ||
RUN apt-get --no-install-recommends -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev | ||
RUN apt-get --no-install-recommends -y install python-dev python-numpy | ||
RUN apt-get --no-install-recommends -y install libtbb-dev | ||
RUN apt-get --no-install-recommends -y install libqt4-dev libgtk2.0-dev | ||
RUN apt-get --no-install-recommends -y install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev | ||
RUN apt-get --no-install-recommends -y install x264 v4l-utils ffmpeg | ||
RUN apt-get --no-install-recommends -y install libgtk2.0-dev | ||
RUN apt-get --no-install-recommends -y install ca-certificates git | ||
|
||
# Downlaod OpenCV Source | ||
RUN git clone --branch 2.4.9 --depth 1 https://github.com/opencv/opencv.git | ||
|
||
# Compile OpenCV | ||
RUN mkdir opencv/build | ||
RUN cd opencv/build && \ | ||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON .. && \ | ||
make -j`nproc` | ||
|
||
# Install OpenCV | ||
RUN cd opencv/build && \ | ||
make install && \ | ||
sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' && \ | ||
ldconfig | ||
|
||
# Build our custom FFmpeg | ||
ENV PATH="/bin:$PATH" | ||
ENV PKG_CONFIG_PATH="$BASE/build/lib/pkgconfig" | ||
|
||
# Install dependencies | ||
RUN apt-get --no-install-recommends -y install \ | ||
autoconf \ | ||
automake \ | ||
build-essential \ | ||
cmake \ | ||
git-core \ | ||
libx264-dev \ | ||
libopencv-dev \ | ||
libass-dev \ | ||
libfreetype6-dev \ | ||
libgnutls28-dev \ | ||
libsdl2-dev \ | ||
libtool \ | ||
libva-dev \ | ||
libvdpau-dev \ | ||
libvorbis-dev \ | ||
libxcb1-dev \ | ||
libxcb-shm0-dev \ | ||
libxcb-xfixes0-dev \ | ||
libunistring-dev \ | ||
pkg-config \ | ||
texinfo \ | ||
wget \ | ||
yasm \ | ||
libx264-dev \ | ||
zlib1g-dev | ||
|
||
# Copy custom FFmpeg source | ||
COPY ./FFmpeg/FFmpeg /FFmpeg | ||
|
||
# Compile FFmpeg | ||
RUN mkdir -p build | ||
RUN cd FFmpeg && \ | ||
./configure \ | ||
--prefix="/build" \ | ||
--pkg-config-flags="--static" \ | ||
--extra-cflags="-I/build/include -march=native" \ | ||
--extra-ldflags="-L/build/lib" \ | ||
--extra-libs="-lpthread -lm" \ | ||
--ld="g++" \ | ||
--bindir="/usr/local/bin" \ | ||
--enable-gnutls \ | ||
--enable-libass \ | ||
--enable-libfreetype \ | ||
--enable-libfontconfig \ | ||
--enable-libvorbis \ | ||
--enable-gpl \ | ||
--enable-libx264 \ | ||
--enable-libopencv \ | ||
--enable-nonfree | ||
RUN cd FFmpeg && make -j`nproc` && make install | ||
|
||
RUN mkdir -p /libraries/usr/lib /libraries/lib | ||
RUN ldd /usr/local/bin/ffmpeg | grep "/usr/lib" | awk 'NF == 4 { system("cp " $3 " /libraries/usr/lib") }' | ||
RUN ldd /usr/local/bin/ffmpeg | grep -v "/usr/lib" | awk 'NF == 4 { system("cp " $3 " /libraries/lib") }' | ||
|
||
# Prepare Node related stuff | ||
FROM node:lts-slim AS node-builder | ||
|
||
# Copy package descriptions | ||
COPY ./dashjs/package*.json /dashjs/ | ||
COPY ./server/app/package*.json /server/app/ | ||
|
||
# Install dependencies | ||
RUN npm --prefix /dashjs ci | ||
RUN npm --prefix /server/app ci | ||
|
||
# Copy source | ||
COPY ./dashjs/. /dashjs/ | ||
COPY ./server/. /server/ | ||
|
||
# Link DASH.js globally | ||
RUN cd /dashjs && npm link | ||
RUN cd /server/app && npm link dashjs | ||
|
||
# Build products | ||
RUN npm --prefix /server/app run build | ||
RUN npm i -g pkg | ||
RUN cd /server && pkg -C GZip -t latest-linux-x64 gpac-dash.js | ||
|
||
# Finalize the image | ||
FROM ubuntu:xenial | ||
EXPOSE 80 | ||
|
||
# Install Node.js & NGINX | ||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y nginx figlet && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=ffmpeg-builder /libraries/usr/lib /usr/lib/x86_64-linux-gnu/ | ||
COPY --from=ffmpeg-builder /libraries/lib /lib/x86_64-linux-gnu/ | ||
COPY --from=ffmpeg-builder /usr/local/bin/ff* /usr/local/bin/ | ||
|
||
# Setup NGINX | ||
COPY ./config/nginx.prod.conf /etc/nginx/nginx.conf | ||
|
||
# Prepare Dash.JS & Live Stream Host | ||
COPY --from=node-builder /server/gpac-dash /usr/local/bin/ | ||
COPY --from=node-builder /server/app/build /opt/server | ||
|
||
COPY ./scripts/entrypoint.sh /opt/entrypoint.sh | ||
ENTRYPOINT [ "/opt/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
worker_processes auto; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
types { | ||
text/html html; | ||
text/css css; | ||
text/javascript js; | ||
} | ||
root /opt/server; | ||
index index.html; | ||
} | ||
|
||
location /content { | ||
add_header Cache-Control no-cache; | ||
proxy_pass http://127.0.0.1:8000; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
INPUT_FILE=$1 | ||
VISUALIZATION=$2 | ||
|
||
if [ -z $INPUT_FILE ]; then | ||
echo "No input file specified" | ||
exit 1 | ||
fi | ||
|
||
if [ -z $VISUALIZATION ]; then | ||
VISUALIZATION=0 | ||
else | ||
VISUALIZATION=3 | ||
fi | ||
|
||
# Start NGINX | ||
nginx | ||
|
||
# Start GPAC | ||
cd /opt | ||
(gpac-dash -chunk-media-segments -cors &) >/dev/null 2>&1 | ||
|
||
# Show banner | ||
figlet "A-CAPSC Demonstration" | ||
echo "============================================================" | ||
echo | ||
echo "Please give us a moment to start up..." | ||
echo "Streaming to: http://localhost/" | ||
|
||
# Start DASH Stream | ||
SOURCE=$(realpath /home/$INPUT_FILE) | ||
TARGET=$(realpath /opt/content/) | ||
|
||
mkdir -p $TARGET | ||
|
||
GOP_SIZE=60 | ||
PRESET=ultrafast | ||
V_SIZE=1280x720 | ||
|
||
ffmpeg \ | ||
-stream_loop -1 -re -i $SOURCE \ | ||
-c:v libx264 -keyint_min $GOP_SIZE -g $GOP_SIZE -pix_fmt yuv420p -r 30 \ | ||
-vf "sa=snooker:$VISUALIZATION" \ | ||
-map v:0 -s:0 $V_SIZE \ | ||
-init_seg_name init\$RepresentationID\$.\$ext\$ -media_seg_name chunk\$RepresentationID\$-\$Number%05d\$.\$ext\$ \ | ||
-adaptation_sets "id=0,streams=v" \ | ||
-use_template 1 -use_timeline 0 \ | ||
-frag_type every_frame \ | ||
-seg_duration 10 \ | ||
-streaming 1 -ldash 1 -tune zerolatency \ | ||
-preset $PRESET \ | ||
-f dash $TARGET/app.mpd >/dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
BASE=$(dirname "$0") | ||
cd $BASE/../development | ||
cd $BASE/../server | ||
forever ./gpac-dash.js -chunk-media-segments -cors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/bin/bash | ||
BASE=$(dirname "$0") | ||
BASE=$(pwd) | ||
|
||
# Start NGINX | ||
nginx -c $BASE/../config/nginx.conf -s stop >> /dev/null | ||
nginx -c $BASE/../config/nginx.conf | ||
nginx -s stop >/dev/null 2>&1 | ||
nginx -c $BASE/config/nginx.dev.conf | ||
|
||
# Start Next.js | ||
echo http://localhost/tv | ||
npm --prefix $BASE/../development/app run dev | ||
# Start React | ||
BROWSER=none npm --prefix $BASE/server/app run start |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters