From 004bcfa62933bc3b7b495a44349b79af17ee2d94 Mon Sep 17 00:00:00 2001 From: Marcus Johansson Date: Tue, 11 Feb 2020 17:00:12 +0100 Subject: [PATCH 1/5] Basic auth --- docker-compose.yml | 2 +- docker/Dockerfile | 3 +++ docker/config/.htpasswd | 1 + docker/config/app.conf | 14 +++++++++++++- videos/.gitkeep | 0 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 docker/config/.htpasswd mode change 100644 => 100755 videos/.gitkeep diff --git a/docker-compose.yml b/docker-compose.yml index 58881a6..463ffc4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.5' services: encoder_validator: - image: registry.oskdev.de:5000/encoder-validator + image: compuccino/encoder-validator container_name: encoder-validator hostname: encoder-validator network_mode: host diff --git a/docker/Dockerfile b/docker/Dockerfile index 87e9b50..7547307 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,5 +25,8 @@ COPY config/app.conf /etc/apache2/sites-enabled/ RUN mkdir /videos RUN mkdir /validation-config +RUN mkdir /htpasswd +COPY config/.htpasswd /htpasswd +RUN chown -R www-data:www-data /htpasswd COPY config/entrypoint.sh /sbin/entrypoint.sh \ No newline at end of file diff --git a/docker/config/.htpasswd b/docker/config/.htpasswd new file mode 100644 index 0000000..bb09481 --- /dev/null +++ b/docker/config/.htpasswd @@ -0,0 +1 @@ +admin:{SHA}0DPiKuNIrrVmD8IUCuw1hQxNqZc= \ No newline at end of file diff --git a/docker/config/app.conf b/docker/config/app.conf index cd0f461..1dcc616 100644 --- a/docker/config/app.conf +++ b/docker/config/app.conf @@ -6,11 +6,17 @@ Alias "/videos" "/videos" + AuthType Basic + AuthName "Please validate" + AuthUserFile "/htpasswd/.htpasswd" + Require valid-user + Options FollowSymLinks AllowOverride None AddDefaultCharset utf-8 DirectoryIndex index.php - Require all granted + Order allow,deny + Allow from all RewriteEngine On @@ -29,6 +35,12 @@ + AuthType Basic + AuthName "Please validate" + AuthUserFile "/htpasswd/.htpasswd" + Require valid-user + Order allow,deny + Allow from all \ No newline at end of file diff --git a/videos/.gitkeep b/videos/.gitkeep old mode 100644 new mode 100755 From 19814dfdd4077000ea1acac53e60671b294e3fea Mon Sep 17 00:00:00 2001 From: Marcus Johansson Date: Fri, 14 Feb 2020 11:27:37 +0100 Subject: [PATCH 2/5] Basic Auth + Public Image --- .gitignore | 1 + docker/Dockerfile | 3 ++- docker/build.sh | 4 ++- .../1080p-h264-stereo-aac-25fps-iframe50.yaml | 25 +++++++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 validation-config/1080p-h264-stereo-aac-25fps-iframe50.yaml diff --git a/.gitignore b/.gitignore index 762556a..d572bec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /videos/*.mp4 /videos/*.ts /videos/*.json +/docker/app \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 7547307..85bc75a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -29,4 +29,5 @@ RUN mkdir /htpasswd COPY config/.htpasswd /htpasswd RUN chown -R www-data:www-data /htpasswd -COPY config/entrypoint.sh /sbin/entrypoint.sh \ No newline at end of file +COPY config/entrypoint.sh /sbin/entrypoint.sh +COPY app /var/www/app \ No newline at end of file diff --git a/docker/build.sh b/docker/build.sh index 1459b5c..d2b441c 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,3 +1,5 @@ #!/bin/bash +cp ../app ./ docker build . -t compuccino/encoder-validator:latest -docker push compuccino/encoder-validator:latest \ No newline at end of file +docker push compuccino/encoder-validator:latest +rm -rf ./app \ No newline at end of file diff --git a/validation-config/1080p-h264-stereo-aac-25fps-iframe50.yaml b/validation-config/1080p-h264-stereo-aac-25fps-iframe50.yaml new file mode 100644 index 0000000..4c053bf --- /dev/null +++ b/validation-config/1080p-h264-stereo-aac-25fps-iframe50.yaml @@ -0,0 +1,25 @@ +video: + format: + and: + - or: + - exact: avc + - exact: h264 + - not-exact: av1 + width: + exact: 1920 + height: + exact: 1080 + frameRate: + exact: 25 +audio: + format: + and: + - contains: aac + - not-exact: hd-aac + channelS: + exact: 2 +# Frames is a special solution with it's own rules +frames: + keyFrameDistance: + min: 50 + max: 50 \ No newline at end of file From 685ad7a856c5510f8bf0b818fc7b460f02b892e8 Mon Sep 17 00:00:00 2001 From: Marcus Johansson Date: Fri, 14 Feb 2020 16:07:21 +0100 Subject: [PATCH 3/5] Fixed some animations --- app/js/list-logic.js | 26 ++++++++++++++++++++++---- app/rtmp-pull.php | 2 -- app/rtmp.php | 2 +- app/status.php | 2 +- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/js/list-logic.js b/app/js/list-logic.js index 5022a5a..76cca24 100644 --- a/app/js/list-logic.js +++ b/app/js/list-logic.js @@ -1,3 +1,7 @@ +var lastStatus = false; +var lastFetchAmount = 0; +var waitingForNew = false; + $(document).ready(function() { checkStatus(true); checkList(); @@ -118,6 +122,10 @@ function cancelTest() { function checkList() { $.getJSON("/list.php", function( json ) { var html = ''; + if (waitingForNew) { + html = html + 'Processing a new video, have patience.
'; + html = html + '
'; + } for (row of json.list) { var link = '/info.php?id=' + row.number; html = html + '' + row.number + '' + row.date + ''; @@ -129,8 +137,13 @@ function checkList() { } html = html + ''; } - $('#result-set tbody').html(html); - setTimeout(checkList, 20000); + if (lastFetchAmount !== json.list.length || waitingForNew) { + waitingForNew = false; + $('#result-set tbody').html(html); + } + + lastFetchAmount = json.list.length; + setTimeout(checkList, 4000); }); } @@ -149,11 +162,11 @@ function checkStatus(first) { } if (json.listening === true && json.running === false && json.listening_format == 'rtmp') { activeStream(); - $('#message').html('Listening to rtmp on rtmp://' + window.location.hostname + ':6872. Please stream to this when ready.'); + $('#message').html('Listening to rtmp on rtmp://' + window.location.hostname + ':6872/test/live. Please stream to this when ready.'); } if (json.listening === true && json.running === true) { activeStream(); - $('#message').html('Currently streaming/reading. It will run for 30 seconds before we validate the stream.'); + $('#message').html('Currently streaming/reading. It will run for 30 seconds or shorter before we validate the stream.'); } if (json.listening === false && json.running === true) { activeStream(); @@ -166,6 +179,11 @@ function checkStatus(first) { $('#test-hls-pull').attr('disabled', false); $('#test-srt').attr('disabled', false); } + + if (lastStatus && !json.running) { + waitingForNew = true; + } + lastStatus = json.running; setTimeout(checkStatus, 500); }); } diff --git a/app/rtmp-pull.php b/app/rtmp-pull.php index 79f8358..712afb5 100644 --- a/app/rtmp-pull.php +++ b/app/rtmp-pull.php @@ -15,8 +15,6 @@ // Tell everyone we are listening file_put_contents('/tmp/listening-rtmp-pull', TRUE); -echo 'ffmpeg -i "' . $url . '" -c:v copy -c:a copy -strict -2 -y -t 30 -f mpegts /videos/test-' . $i . '.flv'; -exit; exec('ffmpeg -i "' . $url . '" -c:v copy -c:a copy -strict -2 -y -t 30 -f mpegts /videos/test-' . $i . '.flv'); exec('ffmpeg -i /videos/test-' . $i . '.flv -c copy /videos/test-' . $i . '.mp4'); diff --git a/app/rtmp.php b/app/rtmp.php index 8a34d97..3a915cc 100644 --- a/app/rtmp.php +++ b/app/rtmp.php @@ -8,7 +8,7 @@ // Tell everyone we are listening file_put_contents('/tmp/listening-rtmp', TRUE); -exec('ffmpeg -f flv -listen 1 -t 30 -i "rtmp://0.0.0.0:6872" -c:v copy -c:a copy -strict -2 -y -f mpegts /videos/test-' . $i . '.flv'); +exec('ffmpeg -f flv -listen 1 -t 30 -i "rtmp://0.0.0.0:6872/test/live" -c:v copy -c:a copy -strict -2 -y -f mpegts /videos/test-' . $i . '.flv'); exec('ffmpeg -i /videos/test-' . $i . '.flv -c copy /videos/test-' . $i . '.mp4'); unlink('/videos/test-' . $i . '.flv'); diff --git a/app/status.php b/app/status.php index e0d870f..80f1cde 100644 --- a/app/status.php +++ b/app/status.php @@ -16,7 +16,7 @@ } if (file_exists('/tmp/listening-rtmp-pull')) { $output['listening'] = TRUE; - $output['listening_format'] = 'rtmp'; + $output['listening_format'] = 'rtmp-pull'; } if (file_exists('/tmp/listening-hls-pull')) { $output['listening'] = TRUE; From 9b3feaefeceb8a005271945b9628b905a7b9b4d0 Mon Sep 17 00:00:00 2001 From: Marcus Johansson Date: Fri, 14 Feb 2020 16:27:10 +0100 Subject: [PATCH 4/5] Fixed build script --- docker/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/build.sh b/docker/build.sh index d2b441c..3b16de6 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -cp ../app ./ +cp -r ../app ./ docker build . -t compuccino/encoder-validator:latest docker push compuccino/encoder-validator:latest rm -rf ./app \ No newline at end of file From 10c511a32f79a47ebfb07b26b2189b031e510b76 Mon Sep 17 00:00:00 2001 From: Marcus Johansson Date: Mon, 17 Feb 2020 15:23:51 +0100 Subject: [PATCH 5/5] Authorize all files --- app/cancel.php | 1 + app/credentials.php | 2 ++ app/hls-pull.php | 1 + app/info.php | 1 + app/list.php | 2 ++ app/rtmp-pull.php | 1 + app/rtmp.php | 1 + app/srt.php | 1 + app/status.php | 2 ++ 9 files changed, 12 insertions(+) diff --git a/app/cancel.php b/app/cancel.php index 3323b6c..f0b5b6f 100644 --- a/app/cancel.php +++ b/app/cancel.php @@ -1,5 +1,6 @@ FALSE, 'running' => FALSE,