problems added

hwip
Hugh Smalley 2 years ago
commit af605ca599

40
265

@ -0,0 +1,40 @@
#!/bin/bash
set -o pipefail
IFS=$'\n\t'
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu/
# You'll want to run this kinda like this...
# find /mnt/ -maxdepth 25 -regex ".*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\|avi\|m4v\)" | parallel ./parallel_convert_265 {}
# OR
# parallel 'find {} -type f -name "*.mkv"' ::: /Muninn/TV /Muninn/Movies | parallel --progress ~/convert265/265 {}
for video; do
d=$(dirname "$video")
filename=$(basename "$video")
extension="${filename##*.}"
filename="${filename%.*}"
audio_codec=$(mediainfo --Inform="Audio;%Format%" "${video}")
video_codec=$(mediainfo --Inform="Video;%Format%" "${video}")
attachment=$(mediainfo --Inform="General;%Attachments%" "${video}")
video_width=$(mediainfo --Inform="Video;%Width%" "${video}")
color_primaries=$(mediainfo --Inform="Video;%colour_primaries%" "${video}")
echo -e "${video} // ${video_codec} // ${audio_codec} // ${video_width} // ${attachment} // ${color_primaries}"
if [[ -f "${d}/poster.jpg" ]]; then
poster="${d}/poster.jpg"
elif [[ -f "${d}/${filename}.jpg" ]]; then
poster="${d}/${filename}.jpg"
else
poster=""
fi
if [[ ! ${video_codec} =~ "HEVC" ]] || [[ ! ${audio_codec} =~ "Opus" ]] ; then
_filename=$(echo "${filename}" | sed -e 's/h264/x265/g' -e 's/x264/x265/g' -e 's/XviD/x265/g' -e 's/AAC/Opus/g' -e 's/DTS/Opus/g' -e 's/EAC3/Opus/g' -e 's/AC3/Opus/g' -e 's/TrueHD/Opus/g' -e 's/Vorbis/Opus/g' -e 's/Atmos//g').mkv
#-c:a libopus -b:a 128k -vbr on -compression_level 10 -frame_duration 60 -application audio -mapping_family 1 -ac 6 \
~/convert265/tools/ffmpeg -hide_banner -loglevel info -y -hwaccel auto -analyzeduration 20000000 -probesize 20000000 \
-i "${video}" -map 0:v -map 0:a -map 0:s? -map 0:d? -map 0:t? -c:s copy \
-c:v hevc_nvenc -rc-lookahead 30 -surfaces 64 -qmin 0 -qmax 24 -profile:v main10 -preset p7 -tune hq -multipass 1 \
-c:a libopus -b:a 128k -vbr on -compression_level 10 -frame_duration 60 -application audio -mapping_family 1 -ac 6 \
-max_muxing_queue_size 1024 -movflags +faststart -movflags use_metadata_tags "/dev/shm/$_filename" || exit 1
cmp "/dev/shm/${_filename}" "${video}" || rm -vf "${video}"
mv -vu "/dev/shm/${_filename}" "${d}/${_filename}" || rm -f "/dev/shm/${_filename}"
fi
done

@ -0,0 +1,37 @@
#!/bin/bash
set -o pipefail
IFS=$'\n\t'
# You'll want to run this kinda like this...
# find /mnt/ -maxdepth 25 -regex ".*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\|avi\|m4v\)" | parallel ./parallel_convert_265 {}
# OR
# parallel 'find {} -type f -name "*.mkv"' ::: /Muninn/TV /Muninn/Movies | parallel --progress ~/convert265/265 {}
# parallel 'find {} -type f -maxdepth 5 -regex ".*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\|avi\|m4v\)"' ::: /Muninn/TV /Muninn/Movies | parallel --jobs 2 --progress ~/convert265/265 {}
for video; do
d=$(dirname "$video")
filename=$(basename "$video")
extension="${filename##*.}"
filename="${filename%.*}"
audio_codec=$(mediainfo --Inform="Audio;%Format%" "${video}")
video_codec=$(mediainfo --Inform="Video;%Format%" "${video}")
echo -e "${video} // ${video_codec} // ${audio_codec}"
if [[ ! ${video_codec} =~ "HEVC" ]] || [[ ! ${audio_codec} =~ "Opus" ]] ; then
_filename=$(echo "${filename}" | sed -e 's/h264/x265/g' -e 's/x264/x265/g' -e 's/XviD/x265/g' -e 's/AAC/Opus/g' -e 's/DTS/Opus/g' -e 's/EAC3/Opus/g' -e 's/AC3/Opus/g' -e 's/TrueHD/Opus/g' -e 's/Vorbis/Opus/g' -e 's/Atmos//g')_H265.mkv
ffmpeg -hide_banner -loglevel info -y -threads 4 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -analyzeduration 20000000 -probesize 20000000 \
-i "${video}" -map 0:v -map 0:a -map 0:s? -map 0:d? -map 0:t? -c:s copy \
-vf 'scale_vaapi=format=p010,scale_vaapi=w=1920:-2' \
-c:v hevc_vaapi -profile:v main10 \
-c:a copy \
-max_muxing_queue_size 1024 -movflags +faststart -movflags use_metadata_tags \
"/dev/shm/$_filename" || exit 1
mv -vu "/dev/shm/${_filename}" "${d}/${_filename}" || rm -f "/dev/shm/${_filename}"
if [[ -f "${d}/${_filename}" ]]; then
cmp "${d}/${_filename}" "${video}" || rm -vf "${video}"
fi
fi
done
#-vf 'format=p010,hwupload,scale=1920x1080:flags=lanczos' -c:v hevc_vaapi -profile:v main10 \
#-vf 'scale_vaapi=format=p010,scale_vaapi=w=1920' \
#-c:v hevc_vaapi -profile:v main10 -b:v 15M \

@ -0,0 +1,33 @@
#!/bin/bash
set -o pipefail
IFS=$'\n\t'
# You'll want to run this kinda like this...
# find /mnt/ -maxdepth 25 -regex ".*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\|avi\|m4v\)" | parallel ./parallel_convert_265 {}
# OR
# parallel 'find {} -type f -name "*.mkv"' ::: /Muninn/TV /Muninn/Movies | parallel --progress ~/convert265/265 {}
# parallel 'find {} -type f -maxdepth 5 -regex ".*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\|avi\|m4v\)"' ::: /Muninn/TV /Muninn/Movies | parallel --jobs 2 --progress ~/convert265/265 {}
for video; do
d=$(dirname "$video")
filename=$(basename "$video")
extension="${filename##*.}"
filename="${filename%.*}"
audio_codec=$(mediainfo --Inform="Audio;%Format%" "${video}")
video_codec=$(mediainfo --Inform="Video;%Format%" "${video}")
echo -e "${video} // ${video_codec} // ${audio_codec}"
if [[ ! ${video_codec} =~ "HEVC" ]] || [[ ! ${audio_codec} =~ "Opus" ]] ; then
_filename=$(echo "${filename}" | sed -e 's/h264/x265/g' -e 's/x264/x265/g' -e 's/XviD/x265/g' -e 's/AAC/Opus/g' -e 's/DTS/Opus/g' -e 's/EAC3/Opus/g' -e 's/AC3/Opus/g' -e 's/TrueHD/Opus/g' -e 's/Vorbis/Opus/g' -e 's/Atmos//g').mkv
ffmpeg -hide_banner -loglevel info -y -threads 4 -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -analyzeduration 20000000 -probesize 20000000 \
-i "${video}" -map 0:v:0 -map 0:a \
-c:v hevc_vaapi -profile:v main10 \
-c:a libopus -b:a 128k -vbr on -compression_level 10 -frame_duration 60 -application audio -mapping_family 1 -ac 2 \
-max_muxing_queue_size 1024 -movflags +faststart -movflags use_metadata_tags \
"/dev/shm/$_filename" || exit 1
mv -vu "/dev/shm/${_filename}" "${d}/${_filename}" || rm -f "/dev/shm/${_filename}"
if [[ -f "${d}/${_filename}" ]]; then
cmp "${d}/${_filename}" "${video}" || rm -vf "${video}" "/dev/shm/${_filename}-0.log"
fi
fi
done

@ -0,0 +1,34 @@
#!/bin/bash
set -o pipefail
IFS=$'\n\t'
# You'll want to run this kinda like this...
# find /mnt/ -maxdepth 25 -regex ".*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\|avi\|m4v\)" | parallel ./parallel_convert_265 {}
# OR
# parallel 'find {} -type f -name "*.mkv"' ::: /Muninn/TV /Muninn/Movies | parallel --progress ~/convert265/265 {}
# parallel 'find {} -type f -maxdepth 5 -regex ".*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\|avi\|m4v\)"' ::: /Muninn/TV /Muninn/Movies | parallel --jobs 2 --progress ~/convert265/265 {}
for video; do
d=$(dirname "$video")
filename=$(basename "$video")
extension="${filename##*.}"
filename="${filename%.*}"
audio_codec=$(mediainfo --Inform="Audio;%Format%" "${video}")
video_codec=$(mediainfo --Inform="Video;%Format%" "${video}")
echo -e "${video} // ${video_codec} // ${audio_codec}"
if [[ ! ${video_codec} =~ "HEVC" ]] || [[ ! ${audio_codec} =~ "Opus" ]] ; then
_filename=$(echo "${filename}" | sed -e 's/h264/x265/g' -e 's/x264/x265/g' -e 's/XviD/x265/g' -e 's/AAC/Opus/g' -e 's/DTS/Opus/g' -e 's/EAC3/Opus/g' -e 's/AC3/Opus/g' -e 's/TrueHD/Opus/g' -e 's/Vorbis/Opus/g' -e 's/Atmos//g').mkv
nice -n 19 ffmpeg -hide_banner -loglevel info -y -threads 4 -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -analyzeduration 20000000 -probesize 20000000 \
-i "${video}" -map 0:v -map 0:a -map 0:s? -map 0:d? -map 0:t? -c:s copy \
-vf 'scale_vaapi=format=p010,scale_vaapi=w=1920:-2' \
-c:v hevc_vaapi -profile:v main10 \
-c:a libopus -b:a 128k -vbr on -compression_level 10 -frame_duration 60 -application audio -mapping_family 1 -ac 2 \
-max_muxing_queue_size 1024 -movflags +faststart -movflags use_metadata_tags \
"/dev/shm/$_filename" || exit 1
mv -vu "/dev/shm/${_filename}" "${d}/${_filename}" || rm -f "/dev/shm/${_filename}"
if [[ -f "${d}/${_filename}" ]]; then
cmp "${d}/${_filename}" "${video}" || rm -vf "${video}"
fi
fi
done

@ -0,0 +1,21 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,10 @@
# convert265
Script to convert media to x264
Edit the path for the find command in the normal one.
To make it even more faster you'll want to run this kinda like this...
parallel ./parallel_convert_265 . ::: $(find /mnt/ -maxdepth 25 -regex ".*\.\(mkv\|mp4\|wmv\|flv\|webm\|mov\|avi\|m4v\)")

Binary file not shown.

@ -0,0 +1,22 @@
#!/bin/bash
set -o pipefail
IFS=$'\n\t'
# you want to do something like this
# for x in $(echo "*"); do cd /Muninn/TV/"${x}"; ~/convert265/season_posters; done
cp -aln poster.jpg Season\ */
cp -al season01-poster.jpg Season\ 1/poster.jpg || cp -al poster.jpg Season\ 1/poster.jpg
cp -al season02-poster.jpg Season\ 2/poster.jpg || cp -al poster.jpg Season\ 2/poster.jpg
cp -al season03-poster.jpg Season\ 3/poster.jpg || cp -al poster.jpg Season\ 3/poster.jpg
cp -al season04-poster.jpg Season\ 4/poster.jpg || cp -al poster.jpg Season\ 4/poster.jpg
cp -al season05-poster.jpg Season\ 5/poster.jpg || cp -al poster.jpg Season\ 5/poster.jpg
cp -al season06-poster.jpg Season\ 6/poster.jpg || cp -al poster.jpg Season\ 6/poster.jpg
cp -al season07-poster.jpg Season\ 7/poster.jpg || cp -al poster.jpg Season\ 7/poster.jpg
cp -al season08-poster.jpg Season\ 8/poster.jpg || cp -al poster.jpg Season\ 8/poster.jpg
cp -al season09-poster.jpg Season\ 9/poster.jpg || cp -al poster.jpg Season\ 9/poster.jpg
cp -al season10-poster.jpg Season\ 10/poster.jpg || cp -al poster.jpg Season\ 10/poster.jpg
cp -al season10-poster.jpg Season\ 11/poster.jpg || cp -al poster.jpg Season\ 11/poster.jpg
cp -al season10-poster.jpg Season\ 12/poster.jpg || cp -al poster.jpg Season\ 12/poster.jpg
cp -al season10-poster.jpg Season\ 13/poster.jpg || cp -al poster.jpg Season\ 13/poster.jpg
cp -al season10-poster.jpg Season\ 14/poster.jpg || cp -al poster.jpg Season\ 14/poster.jpg
cp -al season10-poster.jpg Season\ 15/poster.jpg || cp -al poster.jpg Season\ 15/poster.jpg

Binary file not shown.
Loading…
Cancel
Save