소스 검색

Add 'convert_video.sh'

ffmpeg script to compress mp4 files using quicksync
neal 5 년 전
부모
커밋
48f9766af3
1개의 변경된 파일과 16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      convert_video.sh

+ 16 - 0
convert_video.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+function codec {
+    ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 $1
+}
+for i in *.mp4
+do j="$(codec $i)"
+   if [ $j == h264 ]
+   then
+     ffmpeg -hwaccel qsv -c:v h264_qsv -i $i -c:v h264_qsv -global_quality 20 -preset slow done/$i
+     mv $i $i.done
+   elif [ $j == hevc ]
+   then
+     ffmpeg -hwaccel qsv -c:v hevc_qsv -i $i -c:v hevc_qsv -global_quality 20 -preset slow done/$i
+     mv $i $i.done
+   fi
+done