workaround trace

This commit is contained in:
Arsimael Inshan 2022-02-02 22:54:08 +01:00
parent 16ea482323
commit 943309a8de

View File

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
GPU=nv #Which Hardware to use? nv = nvidia, amd = amdgpu; intel = intel qsv; cpu = CPU encoding
BASEFOLDER_SOURCE="/path/to/source" BASEFOLDER_SOURCE="/path/to/source"
BASEFOLDER_DESTIN="/path/to/destination" BASEFOLDER_DESTIN="/path/to/destination"
FOLDERS_TO_SCAN=( FOLDERS_TO_SCAN=(
@ -6,9 +9,8 @@ FOLDERS_TO_SCAN=(
"Folder 2" "Folder 2"
"Also a Folder" "Also a Folder"
) )
GPU=nv #Which Hardware to use? nv = nvidia, amd = amdgpu; intel = intel qsv; cpu = CPU encoding
#---------- NO EDIT BELOW HERE ---------- #---------- DO NOT EDIT BELOW HERE EXCEPT YOU KNOW WHAT YOU ARE DOING ----------
BFSL=$(expr length ${BASEFOLDER_SOURCE}) BFSL=$(expr length ${BASEFOLDER_SOURCE})
BFSL=$((BFSL + 1)) BFSL=$((BFSL + 1))
@ -17,6 +19,8 @@ ffmpeg_input_opts_amd=(
-hwaccel vaapi -hwaccel vaapi
-hwaccel_output_format vaapi -hwaccel_output_format vaapi
-hwaccel_device amdgpu -hwaccel_device amdgpu
-nostdin
-stats
) )
ffmpeg_output_opts_amd=( ffmpeg_output_opts_amd=(
@ -29,6 +33,9 @@ ffmpeg_output_opts_amd=(
) )
ffmpeg_input_opts_nv=( ffmpeg_input_opts_nv=(
-nostdin
-stats
) )
ffmpeg_output_opts_nv=( ffmpeg_output_opts_nv=(
@ -40,6 +47,8 @@ ffmpeg_output_opts_nv=(
ffmpeg_input_opts_intel=( ffmpeg_input_opts_intel=(
-hwaccel qsv -hwaccel qsv
-nostdin
-stats
) )
ffmpeg_output_opts_intel=( ffmpeg_output_opts_intel=(
@ -49,6 +58,18 @@ ffmpeg_output_opts_intel=(
-c:s copy -c:s copy
) )
ffmpeg_input_opts_cpu=(
-nostdin
-stats
)
ffmpeg_output_opts_cpu=(
-map 0
-c:v libx265
-c:a copy
-c:s copy
)
for i in "${FOLDERS_TO_SCAN[@]}"; do for i in "${FOLDERS_TO_SCAN[@]}"; do
find ${BASEFOLDER_SOURCE}/"${i}" -type f >temp.txt find ${BASEFOLDER_SOURCE}/"${i}" -type f >temp.txt
while IFS= read -r LINE; do while IFS= read -r LINE; do
@ -60,19 +81,29 @@ for i in "${FOLDERS_TO_SCAN[@]}"; do
case ${GPU} in case ${GPU} in
nv) nv)
echo -n "Using nVidia cuda" echo -n "Using nVidia cuda"
echo "Encoding file ${FILE}"
ffmpeg ${ffmpeg_input_opts_nv[@]} -i "${SPATH}/${FILE}" ${ffmpeg_output_opts_nv[@]} "${DPATH}/${FILE}" ffmpeg ${ffmpeg_input_opts_nv[@]} -i "${SPATH}/${FILE}" ${ffmpeg_output_opts_nv[@]} "${DPATH}/${FILE}"
echo -e "------------------\n\n"
;; ;;
amd) amd)
echo -n "using AMDGPU" echo -n "using AMDGPU"
echo "Encoding file ${FILE}"
ffmpeg ${ffmpeg_input_opts_amd[@]} -i "${SPATH}/${FILE}" ${ffmpeg_output_opts_amd[@]} "${DPATH}/${FILE}" ffmpeg ${ffmpeg_input_opts_amd[@]} -i "${SPATH}/${FILE}" ${ffmpeg_output_opts_amd[@]} "${DPATH}/${FILE}"
echo -e "------------------\n\n"
;; ;;
intel) intel)
echo -n "Using Intel QSV" echo -n "Using Intel QSV"
echo "Encoding file ${FILE}"
ffmpeg ${ffmpeg_input_opts_intel[@]} -i "${SPATH}/${FILE}" ${ffmpeg_output_opts_intel[@]} "${DPATH}/${FILE}" ffmpeg ${ffmpeg_input_opts_intel[@]} -i "${SPATH}/${FILE}" ${ffmpeg_output_opts_intel[@]} "${DPATH}/${FILE}"
echo -e "------------------\n\n"
;; ;;
*) *)
echo -n "Using CPU encoding" echo -n "Using CPU encoding"
;; ;;
echo -n "Using CPU"
echo "Encoding file ${FILE}"
ffmpeg ${ffmpeg_input_opts_cpu[@]} -i "${SPATH}/${FILE}" ${ffmpeg_output_opts_cpu[@]} "${DPATH}/${FILE}"
echo -e "------------------\n\n"
esac esac
done < temp.txt done < temp.txt