浏览代码

Add files via upload

MoeClub 5 年之前
父节点
当前提交
1b881b886f
共有 1 个文件被更改,包括 13 次插入5 次删除
  1. 13 5
      ffmpeg/media.sh

+ 13 - 5
ffmpeg/media.sh

@@ -2,6 +2,7 @@
 
 Media="$1"
 Uploader="upload_yuque.sh"
+M3u8mod="m3u8.sh"
 Thread=2
 
 # Main
@@ -13,19 +14,26 @@ else
 fi
 
 MediaName=`basename "${Media}" |cut -d'.' -f1`
+ScriptDir=`dirname $0`
 OutPutM3u8="${MediaName}.m3u8"
 OutPutLog="${MediaName}.log"
 MediaFloder="${MediaName}.output"
 
+# cache
+rm -rf "${OutPutLog}"
+rm -rf "${MediaFloder}"
+mkdir -p "${MediaFloder}"
 
 ## m3u8
-ffmpeg -i ${Media} -threads ${Thread} -thread_type slice -vcodec copy -acodec aac -bsf:v h264_mp4toannexb -map 0 -f segment -segment_list output.m3u8 -segment_time 10 ${MediaFloder}/output_%03d.ts
+cd "${MediaFloder}"
+ffmpeg -i ../${Media} -threads ${Thread} -thread_type slice -vcodec copy -acodec aac -bsf:v h264_mp4toannexb -map 0 -f segment -segment_list ../${OutPutM3u8} -segment_time 20 output_%04d.ts
 
 ## upload
-if [ -f "${Uploader}" ]; then
-  bash "${Uploader}" "${MediaFloder}" |tee -a "${OutPutLog}"
+cd..
+if [ -f "${ScriptDir}/${Uploader}" ]; then
+  bash "${ScriptDir}/${Uploader}" "${MediaFloder}" |tee -a "${OutPutLog}"
   ## mod m3u8
-  if [ -f "m3u8.sh" ]; then
-    bash "m3u8.sh" "${OutPutLog}" "${OutPutM3u8}"
+  if [ -f "${ScriptDir}/${M3u8mod}" ]; then
+    bash "${ScriptDir}/${M3u8mod}" "${OutPutLog}" "${OutPutM3u8}"
   fi
 fi