浏览代码

Update media.sh

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

+ 8 - 9
ffmpeg/media.sh

@@ -15,23 +15,22 @@ fi
 
 
 MediaName=`basename "${Media}" |cut -d'.' -f1`
 MediaName=`basename "${Media}" |cut -d'.' -f1`
 ScriptDir=`dirname $0`
 ScriptDir=`dirname $0`
-OutPutM3u8="${MediaName}.m3u8"
-OutPutLog="${MediaName}.log"
-MediaFloder="${MediaName}.output"
+CurrentDir=`pwd`
+OutPutM3u8="${CurrentDir}/${MediaName}.m3u8"
+OutPutLog="${CurrentDir}/${MediaName}.log"
+MediaFolder="${CurrentDir}/${MediaName}.output"
 
 
 # cache
 # cache
 rm -rf "${OutPutLog}"
 rm -rf "${OutPutLog}"
-rm -rf "${MediaFloder}"
-mkdir -p "${MediaFloder}"
+rm -rf "${MediaFolder}"
+mkdir -p "${MediaFolder}"
 
 
 ## m3u8
 ## m3u8
-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
+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 "${MediaFolder}/output_%04d.ts"
 
 
 ## upload
 ## upload
-cd ..
 if [ -f "${ScriptDir}/${Uploader}" ]; then
 if [ -f "${ScriptDir}/${Uploader}" ]; then
-  bash "${ScriptDir}/${Uploader}" "${MediaFloder}" |tee -a "${OutPutLog}"
+  bash "${ScriptDir}/${Uploader}" "${MediaFolder}" |tee -a "${OutPutLog}"
   ## mod m3u8
   ## mod m3u8
   if [ -f "${ScriptDir}/${M3u8mod}" ]; then
   if [ -f "${ScriptDir}/${M3u8mod}" ]; then
     bash "${ScriptDir}/${M3u8mod}" "${OutPutLog}" "${OutPutM3u8}"
     bash "${ScriptDir}/${M3u8mod}" "${OutPutLog}" "${OutPutM3u8}"