본문 바로가기
ffmpeg compress GPU #코드스니핏

execute_lib265_aac_crx23_qp36_gpu.sh

 

#!/bin/bash 
# https://topis.me/162 ffmpeg acc by gpu
#  ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input.ts -c:v h264_nvenc -b:v 3600k -acodec ac3 -b:a 192k output.mkv
#  ffmpeg -hwaccel vaapi -i "${i}" -vcodec libx265 -acodec aac -crf 28 "${i}.libx265_aac_crx23.mp4" 

for i in * 
# for i in $(find . -name '*.mp4')
  do
  #echo "target file : ${i}"
	#if [${i} -eq execute_lib265_aac_crx23_.sh];then
	if [[ ${i} == *".sh"* ]];then
		echo "${i}. shell script"
	elif [[ ${i} == *"qp36"* ]];then
		echo "${i}. already encoded"
	elif [[ ${i} == *"go.py"* ]];then
		echo "${i}. python script"
	elif [[ ${i} == *"qp40"* ]];then
		echo "${i}. already encoded"
	elif [[ ${i} == *"smi"* ]];then
		echo "${i}. skipped"
	elif [[ ${i} == *"zip"* ]];then
		echo "${i}. skipped"
	else 
		if [[ ${i} == *"resize"* ]];then
			echo "${i}. Resize and Normalization Start"
		#ffmpeg --enable-nvenc -hwaccel cuvid -i "${i}" -c:v h264_cuvid -c:v h264_nvenc -b:v 3600k -acodec ac3 -b:a 192k -crf 28 "${i}.cuvid_ac3_crf28_gpu.mp4"	
		#ffmpeg -hwaccel vaapi -i "${i}" -vcodec libx265 -acodec aac -crf 28 "${i}.libx265_aac_crx23.mp4"
		#ffmpeg -hwaccel vaapi -i "${i}" -vcodec libx264 -acodec aac -crf 23 "${i}.libx265_aac_crx23_gpu.mp4" # 이 옵션은 파일이 더 커짐
		#ffmpeg -hwaccel vaapi -i "${i}" -vcodec libx265 -acodec aac -crf 23 "${i}.libx265_aac_crx23_gpu.mp4" # 이 옵션은 새파일은 줄었는데, 기존 파일은 늘어남
		#ffmpeg -hwaccel vaapi -i "${i}" -vcodec libx265 -acodec aac -crf 32 "${i}.libx265_aac_crx32_gpu.mp4" # 많이 줄어듦 
		#ffmpeg -hwaccel cuda -i "${i}" -vcodec libx265 -acodec aac -crf 32 "${i}.libx265_aac_crx32_gpu.mp4" # 많이 줄어듦 
		#ffmpeg -hwaccel cuvid -i "${i}" -vcodec h264_nvenc -acodec aac -qp 36 -max_muxing_queue_size 1024 "${i}.qp36_gpu.mp4" # 진짜 많이 줄어듦 
		#ffmpeg -hwaccel cuvid -analyzeduration 2147483647 -probesize 2147483647 -i "${i}" -vcodec h264_nvenc -acodec aac -qp 36 -max_muxing_queue_size 1024 "${i}.qp36_gpu.mp4" # 진짜 많이 줄어듦 
			#ffmpeg -hwaccel cuvid -analyzeduration 2147483647 -probesize 2147483647 -i "${i}" -vf scale=1280:720 -vcodec h264_nvenc -acodec aac -qp 36 -max_muxing_queue_size 1024 "${i}.qp36_gpu.mp4" # 진짜 많이 줄어듦 
		#echo ${i}
			ffmpeg -hwaccel cuvid -analyzeduration 2147483647 -probesize 2147483647 -i "${i}" -vf scale=1280:720 -vcodec h264_nvenc -acodec aac -qp 36 -max_muxing_queue_size 4096 "${i}.qp36_gpu.mp4" # 진짜 많이 줄어듦 
		else 
			echo "${i}. Normalization Start"
			ffmpeg -hwaccel cuvid -analyzeduration 2147483647 -probesize 2147483647 -i "${i}" -vcodec h264_nvenc -acodec aac -qp 36 -max_muxing_queue_size 4096 "${i}.qp36_gpu.mp4" # 진짜 많이 줄어듦 
		fi
	fi
   done

댓글