You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
792 B
Bash
20 lines
792 B
Bash
#!/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 35 -pass 1 -an -f null /dev/null && \
|
|
ffmpeg -i $videoToConvert -c:v libvpx-vp9 -b:v 0 -crf 35 -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 |