Added bash script for video transcoding
Lze nechat pravidelně spouštět na serveru. Vyžaduje ffmpeg.master
parent
e1d03f1658
commit
5aac1c0f41
@ -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/\(<video src="\)\(.\{4\}.\{2,5\}\)\(">\)/\1c'$nameWithoutExtension'.webm\3/' $nameWithoutExtension.xml)
|
||||||
|
echo $editedXML > $nameWithoutExtension.xml
|
||||||
|
|
||||||
|
rm $videoToConvert
|
||||||
|
rm ffmpeg2pass-0.log
|
||||||
|
fi
|
||||||
|
fi
|
Reference in New Issue