diff --git a/to_opus/README.md b/to_opus/README.md new file mode 100644 index 0000000..ddf230c --- /dev/null +++ b/to_opus/README.md @@ -0,0 +1,36 @@ +# to_vp9 +This Script is unfinished and not usable. + +# to_opus +converting all audiostreams in all files with given file extension in your current working directory and all subdirectories to opus. +The Script will choose an automatic bitrate for every audiostream dependent on the number of channels and the original bitrate. +See https://wiki.xiph.org/Opus_Recommended_Settings for more information about this. + +If used on containers with video- or multiple audiostreams, this skript will only convert the audiostream and copy all streams in a Matroska container. + +### Flags +```-e``` defines the extension of the files that should be converted
+```-d``` deletes original files after conversion
+```-h``` show help (not implemented) + +### Examples + +convert all files to opus
+```bash to_opus.sh -e "*"``` + +convert all files with .mp3-extension and .flac-extension to opus and deletes original files after that
+```bash to_opus.sh -e mp3 -e flac``` + +convert the audiostream of an movie
+```bash to_opus.sh -e mp4``` + +### Dependencies +- ffmpeg +- Bash 4^ + +### Why opus? + +Opus is an open format and royalty free. It is FOSS. +It is supported on most platforms and has a better quality per bitrate then formats like mp3 or Vorbis. + +![Opus Quality comparison with other formats](https://upload.wikimedia.org/wikipedia/commons/0/01/Opus_quality_comparison.svg) \ No newline at end of file diff --git a/to_opus.sh b/to_opus/to_opus.sh old mode 100644 new mode 100755 similarity index 100% rename from to_opus.sh rename to to_opus/to_opus.sh diff --git a/to_vp9.sh b/to_vp9/to_vp9.sh old mode 100644 new mode 100755 similarity index 53% rename from to_vp9.sh rename to to_vp9/to_vp9.sh index 3a2bc07..26b7e69 --- a/to_vp9.sh +++ b/to_vp9/to_vp9.sh @@ -44,10 +44,12 @@ while :; do encoder=$(echo ${encoders[$encoder]} | awk '{print $2}') break else - echo "number out of range, try again" + echo "Not a valid encoder, try again" fi done +# Choose an GPU, if encoder is GPU accelerated + # write array into string extension="${extension[*]}" # change separator @@ -55,4 +57,22 @@ extension=${extension// /|} for file in **/*.@($extension); do echo $encoder + + #https://wiki.archlinux.org/title/Hardware_video_acceleration + + #VP9_vaapi + #Hardware video acceleration enabled + #https://ffmpeg.org/ffmpeg-all.html#VAAPI-encoders + #https://trac.ffmpeg.org/wiki/Hardware/VAAPI + #ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD129 -i "$file" -map 0 -c copy -c:v vp9_vaapi -rc_mode CQP -look_ahead 1 -bf 2 -bsf:v vp9_raw_reorder,vp9_superframe -compression_level 0 -vf 'hwupload' Der\ VornameCqpLA.mkv + + #VP9_qsv + #--enable-libmfx or --enable-libvpl and Hardware video acceleration enabled + #libvpl vs. libmfx: https://www.intel.com/content/www/us/en/developer/articles/technical/onevpl-in-ffmpeg-for-great-streaming-on-intel-gpus.html + #https://ffmpeg.org/ffmpeg-codecs.html + #https://trac.ffmpeg.org/wiki/Hardware/QuickSync + #https://www.intel.com/content/www/us/en/developer/articles/technical/common-bitrate-control-methods-in-intel-media-sdk.html + #https://www.intel.com/content/www/us/en/developer/articles/technical/advanced-bitrate-control-methods-in-intel-media-sdk.html + #ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD129 -i "$file" -c:v av1_qsv -vf 'hwupload' output.mkv + done