Upload folder with video

How can I upload folder with videofiles? tags, tittes and atributs should be automatically assigned

Comments

  • ohh my bad, I did not attempt to understand the system. The principle is that Cumulus uses Mysql which contains the table of videos, adding random title for the video in the table and then copying to /var/www/cumulusclips/cc-content/uploads/h264(where all videos uploads) rename video at the same title, it appears to the user in web form.
    Thus publish the folder in which the user copies the video and bash script automatically handles the copied video. When i write script i publish it
  • In my cumulus host windows share mounted in "/mnt" folder. In this share users can copy their videofiles, which shuld be treated. This script is published as an example. It can be upgrade for yours needs. After working, videofiles are compressed into 2 times with this ffmpeg options and files can be renamed manualy.


    #!/bin/bash
    DATE=`date +%d-%m-%Y%t%H:%M:%S`
    #read filenames which exist in /mnt
    IFS=$'\n' array=( $(ls /mnt | xargs -n 1 -i echo "{}"))

    for rec in ${array[@]}; do

    filename=$(date +'%d-%m-%y_%T')_$rec
    #in mysql we must input filename without format
    Tabfilename=${filename%.*}
    DATE= $(date +'%d.%m.%y %T')
    #foreache format use own string fffmpeg
    format=$(echo /mnt/$rec | awk -F. '{print $NF}')
    if [ "$format" = "mp4" ];
    then
    ffmpeg -y -i /mnt/$rec -s 640x480 -b 400k -f mp4 /var/www/html/cumulusclips/cc-content/uploads/h264/$Tabfilename.mp4
    echo "mp4"
    elif [ "$format" = "avi" ];
    then
    ffmpeg -y -i /mnt/$rec -s 640x480 -b 400k -vcodec libx264 -crf 20 -f mp4 /var/www/html/cumulusclips/cc-content/uploads/h264/$Tabfilename.mp4
    echo "avi"
    fi
    #we should know video duration
    duration=`ffprobe -i /var/www/html/cumulusclips/cc-content/uploads/h264/$Tabfilename.mp4 -show_format -v quiet | sed -n 's/duration=//p'`
    #i dont want to fight with float variable, it's horrible but it's working for me
    durkrug=${duration%.*}
    duration=$(expr $durkrug / 60):00

    #create thumbs
    ffmpeg -y -i /var/www/html/cumulusclips/cc-content/uploads/h264/$Tabfilename.mp4 -f mjpeg -ss 10 -vframes 1 160x120 /var/www/html/cumulusclips/cc-content/uploads/thumbs/$Tabfilename.jpg


    echo "insert into videos (filename,user_id,title,description,tags,date_created,status,duration) values ('$Tabfilename','4','$Tabfilename','testdesc','testtag','DATE','approved','$duration') " | mysql -mysqluser -vysqlpass cumulusclips;


    done

This discussion has been closed.