From 5aac1c0f41c13275ad9552bbe80b3978c5e23696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Z=C3=A1le=C5=A1=C3=A1k?= Date: Tue, 2 Feb 2021 03:46:05 +0100 Subject: [PATCH] =?UTF-8?q?Added=20bash=20script=20for=20video=20transcodi?= =?UTF-8?q?ng=20Lze=20nechat=20pravideln=C4=9B=20=20spou=C5=A1t=C4=9Bt=20n?= =?UTF-8?q?a=20serveru.=20Vy=C5=BEaduje=20ffmpeg.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- videos/transcode.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 videos/transcode.sh diff --git a/videos/transcode.sh b/videos/transcode.sh new file mode 100755 index 0000000..f361b6c --- /dev/null +++ b/videos/transcode.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [[ ! -f "ffmpeg2pass-0.log" ]]; then + videoToConvert=$(ls -tr | grep -E '^.{4}\.' | grep -v xml | head -1) + if [ ! -z "$videoToConvert" ]; then + + nameWithoutExtension=$(echo $videoToConvert | sed 's/\..*//') + + ffmpeg -i $videoToConvert -c:v libvpx-vp9 -b:v 0 -crf 10 -pass 1 -an -f null /dev/null && \ + ffmpeg -i $videoToConvert -c:v libvpx-vp9 -b:v 0 -crf 10 -pass 2 -c:a libopus transcoding-$nameWithoutExtension.webm + + mv transcoding-$nameWithoutExtension.webm c$nameWithoutExtension.webm + + editedXML=$(sed 's/\(