mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 05:11:04 +00:00
Added scripts for converting and downscaling videos
The videos are downloaded from provided ftp server, converted and reuploaded into an out directory. They can then be referenced in the Video/Audio tab of the AdminConsole
This commit is contained in:
1 parent
3441f338ac
commit
d5eca944bd
2 files changed
+99
No files matched your search
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
#Fetches videos from the given ftp directory, downscales them
|
||||
# and uploads them back into the directory+/out
|
||||
#
|
||||
# Notes on ffmpeg: Make sure to install an ffmpeg version with x264 support.
|
||||
# You can either compile it yourself (there are various online tutorials) or
|
||||
# just download it from the http://www.deb-multimedia.org/ repository (if you use debian)
|
||||
HOST='sapevent.upload.akamai.com'
|
||||
USER='sail'
|
||||
PASS='S4iL!uPlo4D*'
|
||||
LOCALDIR='/tmp/sailvids'
|
||||
SOURCEDIR='/67696/sail/barbados'
|
||||
|
||||
#Create temporary folder for videos
|
||||
#rm -rf $LOCALDIR
|
||||
mkdir $LOCALDIR
|
||||
|
||||
#Download directory content (could be extended to filter for video files)
|
||||
lftp -f "
|
||||
open $HOST
|
||||
user $USER $PASS
|
||||
mirror --verbose -r $SOURCEDIR $LOCALDIR
|
||||
bye
|
||||
"
|
||||
|
||||
#CREATE out dir
|
||||
mkdir $LOCALDIR/out
|
||||
|
||||
#ITERATE FOR VIDEOS
|
||||
VIDEOFILES=$LOCALDIR/*.MP4
|
||||
COUNT=$(find $LOCALDIR -name "*.MP4" -print | wc -l)
|
||||
STEP=0
|
||||
for f in $VIDEOFILES
|
||||
do
|
||||
FILENAME=$(basename "$f")
|
||||
STEP=$(($STEP + 1))
|
||||
echo "Processing Video $STEP/$COUNT: $FILENAME"
|
||||
#Just to make sure that this is no directory
|
||||
test -f "$f" || continue
|
||||
#Actual conversion
|
||||
ffmpeg -y -i "$f" -vcodec libx264 -profile baseline -preset slow -b 1500k -s 1024*576 -r 25 "$LOCALDIR/out/$FILENAME"
|
||||
done
|
||||
|
||||
|
||||
#Mirror directory to remote (since only out/ is changed,
|
||||
# only its contents will be uploaded)
|
||||
lftp -f "
|
||||
open $HOST
|
||||
user $USER $PASS
|
||||
mirror -r --reverse --verbose $LOCALDIR/out $SOURCEDIR/out
|
||||
bye
|
||||
"
|
||||
|
||||
rm -rf $LOCALDIR
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
#Fetches videos from the given ftp directory, downscales them
|
||||
# and uploads them back into the directory+/out
|
||||
# Uses GNU parallel for multi-cpu usage
|
||||
#
|
||||
# Notes on ffmpeg: Make sure to install an ffmpeg version with x264 support.
|
||||
# You can either compile it yourself (there are various online tutorials) or
|
||||
# just download it from the http://www.deb-multimedia.org/ repository (if you use debian)
|
||||
#
|
||||
# Notes on GNU parallel: Make sure to install the GNU version of parallel (there are other
|
||||
# programs with the same command. In debian: sudo apt-get install parallel
|
||||
HOST='sapevent.upload.akamai.com'
|
||||
USER='sail'
|
||||
PASS='S4iL!uPlo4D*'
|
||||
LOCALDIR='/tmp/sailvids'
|
||||
SOURCEDIR='/67696/sail/barbados'
|
||||
|
||||
#Create temporary folder for videos
|
||||
#rm -rf $LOCALDIR
|
||||
mkdir $LOCALDIR
|
||||
|
||||
#Download directory content (could be extended to filter for video files)
|
||||
time lftp -f "
|
||||
open $HOST
|
||||
user $USER $PASS
|
||||
mirror --verbose -r $SOURCEDIR $LOCALDIR
|
||||
bye
|
||||
"
|
||||
|
||||
#CREATE out dir
|
||||
mkdir $LOCALDIR/out
|
||||
#Reference all video files
|
||||
echo "Starting to process videos"
|
||||
#Starts gnu parallel with the conversion jobs
|
||||
time ls $LOCALDIR/*.{MP4,mp4,AVI,avi,3GP,3gp,MPEG,mpeg,MPG,mpg} | parallel -u --gnu 'echo "Starting conversion for: {/}";ffmpeg -y -i {} -vcodec libx264 -profile baseline -preset slow -b 1500k -s 1024*576 -r 25 {//}/out/{/.}.MP4;echo "Finished conversion for: {/}"'
|
||||
|
||||
#Mirror directory to remote
|
||||
time lftp -f "
|
||||
open $HOST
|
||||
user $USER $PASS
|
||||
mirror -r --reverse --verbose $LOCALDIR/out $SOURCEDIR/out
|
||||
bye
|
||||
"
|
||||
|
||||
rm -rf $LOCALDIR
|
||||
Reference in new issue
Block a user