diff --git a/to_opus/to_opus.sh b/to_opus/to_opus.sh index d0424e7..6e6117a 100755 --- a/to_opus/to_opus.sh +++ b/to_opus/to_opus.sh @@ -56,7 +56,10 @@ for file in **/*.@($extension); do # use mkv for videos and for multiple audio streams is_video=$(ffprobe -v error -select_streams V -show_entries stream=codec_type "$file") if [[ ${#channels[@]} -gt 1 || -n "$is_video" ]]; then - ffmpeg -i "$file" -map 0 -map -0:d -map -0:t -c copy -c:a libopus $bitrate_settings-v info -hide_banner "${file%.*}.mkv" && + if [[ ${file: -3} == "mkv" ]]; then + file_out="${file%.*}2.mkv" + else file_out="${file%.*}.mkv"; fi + ffmpeg -i "$file" -map 0 -map -0:d -map -0:t -c copy -c:a libopus $bitrate_settings-v info -hide_banner "$file_out" && if [[ "$delete" = true ]]; then rm "$file"; fi else ffmpeg -i "$file" $bitrate_settings-v info -hide_banner "${file%.*}.opus" && diff --git a/to_vp9/to_vp9.sh b/to_vp9/to_vp9.sh index 4819419..23b3e8c 100755 --- a/to_vp9/to_vp9.sh +++ b/to_vp9/to_vp9.sh @@ -61,13 +61,21 @@ extension="${extension[*]}" extension=${extension// /|} for file in **/*.@($extension); do + if [[ ${file: -3} == "mkv" ]]; then + file_out="${file%.*}2.mkv" + else file_out="${file%.*}.mkv"; fi + + + echo "$encoder" #VP9_vaapi #there are problems with the -global_quality:v/-q:v settings only being able to make quality worse. Help is appreciated #not enough tested. So it is still experimental - #ffmpeg -hide_banner -hwaccel vaapi -vaapi_device $gpu -i "$file" -map 0 -c copy -c:v vp9_vaapi -rc_mode CQP -bf 1 -bsf:v vp9_raw_reorder,vp9_superframe -vf 'hwupload' "${file%.*}.mkv" - + if [[ $encoder == "vp9_vaapi" ]]; then + ffmpeg -hide_banner -hwaccel vaapi -vaapi_device $gpu -i "$file" -map 0 -c copy -c:v vp9_vaapi -rc_mode CQP -bf 1 -bsf:v vp9_raw_reorder,vp9_superframe -vf 'hwupload' "$file_out" + fi + #VP9_qsv #was not able to test it. So it is still experimental #ffmpeg -hide_banner -hwaccel qsv -qsv_device $gpu -i "$file" -c:v av1_qsv -vf 'hwupload' "${file%.*}.mkv"