Browse Source

增加outsider

gemer cheung 4 years ago
parent
commit
99897c2214
4 changed files with 99 additions and 0 deletions
  1. 4 0
      4dage-ffmpeg
  2. 44 0
      cap/batch_video_cover.sh
  3. 10 0
      cap/paths.txt
  4. 41 0
      web-install-outsider.sh

+ 4 - 0
4dage-ffmpeg

@@ -153,6 +153,9 @@ while test $# -gt 0; do
     esac
 done
 
+mkVerison() {
+    echo "4dage-ffmpeg:$version" >>"$outputFolder/version"
+}
 takeVideoCap() {
     FFREPORT=file="$outputFolder/$outputName.cap.txt":level=32 ffmpeg -hide_banner -loglevel error -y -i $tempVideo -r 1 -ss 00:00:01 -vframes 1 -vf "transpose=1,scale=iw/5:ih/5,setsar=1:1" -f image2 "$outputFolder/$outputName.jpg"
 }
@@ -173,6 +176,7 @@ covertVideoTask() {
     FFREPORT=file="$outputFolder/$outputName.$videoFileType.txt":level=32 ffmpeg -i $tempVideo -s 1056x792 -c:v libx264 -profile:v high -level:v 4.1 -vf "scale=iw/2:ih/2" -pix_fmt yuv420p -movflags +faststart -bf 2 -c:a copy "$outputFolder/$outputName.$videoFileType" -y
     FFREPORT=file="$outputFolder/$outputName.flv.txt":level=32 ffmpeg -i $tempVideo -s 1056x792 -c:v libx264 -ar 44100 -profile:v high -level:v 4.1 -vf "scale=iw/2:ih/2" -pix_fmt yuv420p -movflags +faststart -bf 2 -c:a copy "$outputFolder/$outputName.flv" -y
     takeVideoCap
+    mkVerison
     # ffmpeg -i $tempVideo -s 1056x792 -c:v libx265 -movflags faststart -bf 2 -c:a copy "$outputFolder/$outputName.265.$videoFileType" -y
     # export lastOutPutVideo=$outputFolder/$outputName.$videoFileType
     # export lastOutPutVideoFlv="$outputFolder/$outputName.flv"

+ 44 - 0
cap/batch_video_cover.sh

@@ -0,0 +1,44 @@
+#!/bin/bash
+
+paths=$(cat paths.txt)
+picName=''
+videoInput=''
+
+
+takeVideoCap() {
+    ffmpeg -hide_banner -loglevel error -y -i $videoInput -r 1 -ss 00:00:01 -vframes 1 -vf "transpose=1,scale=iw/4:ih/4,setsar=1:1" -f image2 "$filePath/${picName}.jpg"
+}
+
+# fileurl=$1
+# directory=$2
+# /opt/ossutil/ossutil64 cp oss://4dkankan/$fileurl \-rf $directory
+
+for path in $paths; do
+    # pathParam=($path)
+    IFS=", " read -a pathParam <<<$path
+    filePath=${pathParam[0]}
+    code=${pathParam[1]}
+
+    if [ -d $filePath ]; then
+        videoList=("$filePath/*.mp4")
+        if [ ${#videoList[@]} -gt 0 ]; then
+            for video in $videoList; do
+                echo "存在视频: ${video}"
+                filename=$(basename -- "$video")
+                filename="${filename%.*}"
+                export picName=$filename
+                export videoInput=$video
+                echo -e "\033[43;34m cap sucess : $filePath/${picName}.jpg \033[0m"
+                takeVideoCap
+
+                echo -e "upload: video/video${code}"
+                /opt/ossutil/ossutil64 cp -f $filePath/${picName}.jpg oss://4dkankan/video/video${code}/
+                # https://4dkk2.4dage.com/video/videot-tXj1F7V/8.mp4?imagesVersion=5
+
+            done
+        fi
+    else
+        echo -e "\033[0;33m 文件夹不存在: ${filePath} \033[m"
+    fi
+
+done

+ 10 - 0
cap/paths.txt

@@ -0,0 +1,10 @@
+/mnt/data/04d67f148/822047922467110912/4898cab0127d_202103171516481000/results/videos,t-bQGoxnO
+/mnt/data/029ea42e8/822061329467572224/7ca7b00e6772_202103180957505719/results/videos,t-CdcMz3M
+/mnt/data/029ea42e8/822061070460911616/7ca7b00e6772_202103180955573550/results/videos,t-jA07HxJ
+/mnt/data/029ea42e8/822060574761287680/7ca7b00e6772_202103181014456520/results/videos,t-Yp6PmZh
+/mnt/data/029ea42e8/822060406594863104/7ca7b00e6772_202103181016303210/results/videos,t-RorbeDF
+/mnt/data/029ea42e8/822056834037710848/7ca7b00e6772_202103181026294260/results/videos,t-6Khb2sJ
+/mnt/data/0454efda9/821761575101661184/7ca7b00c0675_202103171500304940/results/videos,t-ptHnKTG
+/mnt/data/02fbf551a/821717231883780096/7ca7b00b979f_202103151808497910/results/videos,t-yWfiX5K
+/mnt/data/02fbf551a/821469248969768960/7ca7b00b979f_202103160917440990/results/videos,t-2AYCRXd
+/mnt/data/020baa367/819600506555990016/7ca7b00be91d_202103111527133150/results/videos,t-tXj1F7V

+ 41 - 0
web-install-outsider.sh

@@ -0,0 +1,41 @@
+#!/bin/sh
+
+make_dir () {
+    if [ ! -d $1 ]; then
+        if ! mkdir $1; then            
+            printf "\n Failed to create dir %s" "$1";
+            exit 1
+        fi
+    fi    
+}
+
+command_exists() {
+    if ! [[ -x $(command -v "$1") ]]; then
+        return 1
+    fi
+
+    return 0
+}
+
+TARGET='ffmpeg-build'
+
+if ! command_exists "curl"; then
+    echo "curl not installed.";
+    exit 1
+fi
+
+echo "4dage ffmpeg-build-script-downloader v0.1"
+echo "========================================="
+echo ""
+
+echo "First we create the ffmpeg build directory $TARGET"
+make_dir $TARGET
+cd $TARGET
+
+echo "Now we download and execute the build script"
+echo ""
+
+bash <(curl -s http://git.nps.gemer.xyz/zhangyupeng/4dage-ffmpeg/raw/master/install-4dage)
+bash <(curl -s http://git.nps.gemer.xyz/zhangyupeng/4dage-ffmpeg/raw/master/install-ffmpeg) --build
+
+