mirror of
https://github.com/levogevo/ffmpeg-builder.git
synced 2026-03-16 11:10:10 +00:00
handle when crop values are all 0 and supmover minimally warning about cropping
This commit is contained in:
@@ -266,24 +266,32 @@ setup_pgs_mkv() {
|
|||||||
right=${left}
|
right=${left}
|
||||||
bottom=${top}
|
bottom=${top}
|
||||||
fi
|
fi
|
||||||
# crop sup
|
|
||||||
(
|
# only crop if actually required
|
||||||
set -x
|
if [[ "${left}${top}${right}${bottom}" != "0000" ]]; then
|
||||||
"${SUPMOVER}" \
|
# crop sup
|
||||||
"${ogSup}" \
|
(
|
||||||
"${cropSup}" \
|
set -x
|
||||||
--crop \
|
"${SUPMOVER}" \
|
||||||
"${left}" "${top}" "${right}" "${bottom}" &>"${cropSup}.out" || return 1
|
"${ogSup}" \
|
||||||
)
|
"${cropSup}" \
|
||||||
local cropRet=$?
|
--crop \
|
||||||
# supmover does not error for out-of-bounds subtitles
|
"${left}" "${top}" "${right}" "${bottom}" &>"${cropSup}.out" || return 1
|
||||||
if grep 'Window is outside new screen area' "${cropSup}.out"; then
|
)
|
||||||
echo_fail "check ${cropSup}.out for complete logs"
|
local cropRet=$?
|
||||||
cropRet=1
|
# supmover does not error for out-of-bounds subtitles
|
||||||
fi
|
# so error only when there is most certainly an issue
|
||||||
if [[ ${cropRet} -ne 0 ]]; then
|
if [[ "$(grep -c 'Window is outside new screen area' "${cropSup}.out")" -gt 5 ]]; then
|
||||||
rm -r "${tmpdir}" || return 1
|
echo_fail "check ${cropSup}.out for complete logs"
|
||||||
return 1
|
cropRet=1
|
||||||
|
fi
|
||||||
|
if [[ ${cropRet} -ne 0 ]]; then
|
||||||
|
rm -r "${tmpdir}" || return 1
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# create placeholder copy for replacement
|
||||||
|
cp "${ogSup}" "${cropSup}" || return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# create placeholder copy for replacement
|
# create placeholder copy for replacement
|
||||||
|
|||||||
Reference in New Issue
Block a user