small bugfixes and a better README
This commit is contained in:
parent
f60accf252
commit
e0adaf9c7e
4 changed files with 32 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
||||||
# to_opus
|
# to_opus
|
||||||
converting all audiostreams in all files with given file extension in your current working directory and all subdirectories to opus.
|
This script converts 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.
|
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.
|
See https://wiki.xiph.org/Opus_Recommended_Settings for more information about this.
|
||||||
|
|
||||||
|
|
|
@ -41,16 +41,15 @@ for file in **/*.@($extension); do
|
||||||
readarray -t bitrates <<<"$(ffprobe -v error -select_streams a -show_entries stream=bit_rate -of compact=p=0:nk=1 "$file")"
|
readarray -t bitrates <<<"$(ffprobe -v error -select_streams a -show_entries stream=bit_rate -of compact=p=0:nk=1 "$file")"
|
||||||
|
|
||||||
# set a channel dependend bitrate for every audio stream
|
# set a channel dependend bitrate for every audio stream
|
||||||
# https://wiki.xiph.org/Opus_Recommended_Settings
|
|
||||||
# to use ffmpegs default just comment out this block
|
# to use ffmpegs default just comment out this block
|
||||||
for ((index=0; index<${#channels[@]};index++)); do
|
for ((index=0; index<${#channels[@]};index++)); do
|
||||||
if [[ ${channels[index]} -eq 1 ]]; then
|
if [[ ${channels[index]} -eq 1 ]]; then
|
||||||
if [[ $bitrates == 'N/A' || ${bitrates[index]} -gt 64000 ]]; then bitrate_settings="$bitrate_settings-b:a:$index 64k "; fi
|
if [[ ${bitrates[index]} == 'N/A' || ${bitrates[index]} -gt 64000 ]]; then bitrate_settings="$bitrate_settings-b:a:$index 64k "; fi
|
||||||
elif [[ ${channels[index]} -eq 2 ]]; then
|
elif [[ ${channels[index]} -eq 2 ]]; then
|
||||||
if [[ $bitrates == 'N/A' || ${bitrates[index]} -gt 128000 ]]; then bitrate_settings="$bitrate_settings-b:a:$index 128k "; fi
|
if [[ ${bitrates[index]} == 'N/A' || ${bitrates[index]} -gt 128000 ]]; then bitrate_settings="$bitrate_settings-b:a:$index 128k "; fi
|
||||||
elif [[ ${channels[index]} -lt 6 ]]; then
|
elif [[ ${channels[index]} -lt 6 ]]; then
|
||||||
if [[ $bitrates == 'N/A' || ${bitrates[index]} -gt 256000 ]]; then bitrate_settings="$bitrate_settings-b:a:$index 256k "; fi
|
if [[ ${bitrates[index]} == 'N/A' || ${bitrates[index]} -gt 256000 ]]; then bitrate_settings="$bitrate_settings-b:a:$index 256k "; fi
|
||||||
elif [[ $bitrates == 'N/A' || ${bitrates[index]} -gt 450000 ]]; then bitrate_settings="$bitrate_settings-b:a:$index 450k "; fi
|
elif [[ ${bitrates[index]} == 'N/A' || ${bitrates[index]} -gt 450000 ]]; then bitrate_settings="$bitrate_settings-b:a:$index 450k "; fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# check if it contains video streams (Thumbnails etc. will be ignored)
|
# check if it contains video streams (Thumbnails etc. will be ignored)
|
||||||
|
|
|
@ -1,2 +1,25 @@
|
||||||
# to_vp9
|
# to_vp9
|
||||||
This Script is unfinished and not usable
|
This Script is unfinished and not ready for usage.
|
||||||
|
|
||||||
|
This script converts all videostreams in all files with given file extension in your current working directory and all subdirectories to vp9.
|
||||||
|
The standard settings are in my opinion good for personal storage of movies. Feel free to change them or suggest changes.
|
||||||
|
|
||||||
|
If used on containers with subtitles or audiostreams, this skript will only convert the videostream and copy the other streams in a Matroska container.
|
||||||
|
### Encoders
|
||||||
|
|
||||||
|
### VP9_vaapi
|
||||||
|
|
||||||
|
Needs [Hardware video acceleration](https://wiki.archlinux.org/title/Hardware_video_acceleration) enabled and libva
|
||||||
|
More Information about this:
|
||||||
|
- https://ffmpeg.org/ffmpeg-all.html#VAAPI-encoders
|
||||||
|
- https://trac.ffmpeg.org/wiki/Hardware/VAAPI
|
||||||
|
|
||||||
|
### VP9_qsv
|
||||||
|
|
||||||
|
Needs [Hardware video acceleration](https://wiki.archlinux.org/title/Hardware_video_acceleration) enabled, intel graphics and ffmpeg with --enable-libmfx or --enable-libvpl.
|
||||||
|
More Information about this:
|
||||||
|
- [Differences between libvpl and 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-all.html#QSV-Encoders
|
||||||
|
- 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
|
|
@ -49,6 +49,8 @@ while :; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Choose an GPU, if encoder is GPU accelerated
|
# Choose an GPU, if encoder is GPU accelerated
|
||||||
|
# ls /sys/class/drm/renderD129/device/consumer*/consumer/ | grep supp
|
||||||
|
# lspci | grep ' VGA ' | cut -d" " -f 1 | xargs -i lspci -v -s {}
|
||||||
|
|
||||||
# write array into string
|
# write array into string
|
||||||
extension="${extension[*]}"
|
extension="${extension[*]}"
|
||||||
|
@ -58,21 +60,10 @@ extension=${extension// /|}
|
||||||
for file in **/*.@($extension); do
|
for file in **/*.@($extension); do
|
||||||
echo "$encoder"
|
echo "$encoder"
|
||||||
|
|
||||||
#https://wiki.archlinux.org/title/Hardware_video_acceleration
|
|
||||||
|
|
||||||
#VP9_vaapi
|
#VP9_vaapi
|
||||||
#Hardware video acceleration enabled
|
#ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD129 -i "$file" -map 0 -c copy -c:v vp9_vaapi -rc_mode CQP -bf 1 -bsf:v vp9_raw_reorder,vp9_superframe -compression_level 0 -vf 'hwupload' Der\ VornameCqpLA.mkv
|
||||||
#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
|
#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
|
#ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD129 -i "$file" -c:v av1_qsv -vf 'hwupload' output.mkv
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue