mirror of
https://github.com/levogevo/ffmpeg-builder.git
synced 2026-01-15 19:06:17 +00:00
fix conversion to/from mov_text/srt
This commit is contained in:
@@ -58,6 +58,16 @@ set_subtitle_params() {
|
|||||||
local file="$1"
|
local file="$1"
|
||||||
local convertCodec='eia_608'
|
local convertCodec='eia_608'
|
||||||
local keepLang='eng'
|
local keepLang='eng'
|
||||||
|
|
||||||
|
local defaultTextCodec
|
||||||
|
if [[ ${SAME_CONTAINER} == false && ${FILE_EXT} == 'mkv' ]]; then
|
||||||
|
defaultTextCodec='srt'
|
||||||
|
convertCodec+='|mov_text'
|
||||||
|
else
|
||||||
|
defaultTextCodec='mov_text'
|
||||||
|
convertCodec+='|srt'
|
||||||
|
fi
|
||||||
|
|
||||||
local subtitleParams=()
|
local subtitleParams=()
|
||||||
for stream in $(get_num_streams "${file}" 's'); do
|
for stream in $(get_num_streams "${file}" 's'); do
|
||||||
local codec lang
|
local codec lang
|
||||||
@@ -68,8 +78,8 @@ set_subtitle_params() {
|
|||||||
'-map'
|
'-map'
|
||||||
"-0:${stream}"
|
"-0:${stream}"
|
||||||
)
|
)
|
||||||
elif [[ ${codec} == "${convertCodec}" ]]; then
|
elif [[ ${codec} =~ ${convertCodec} ]]; then
|
||||||
subtitleParams+=("-c:${stream}" "srt")
|
subtitleParams+=("-c:${stream}" "${defaultTextCodec}")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "${subtitleParams[@]}"
|
echo "${subtitleParams[@]}"
|
||||||
@@ -140,7 +150,7 @@ encode_usage() {
|
|||||||
echo -e "\t[-c] use cropdetect (default: ${CROP})"
|
echo -e "\t[-c] use cropdetect (default: ${CROP})"
|
||||||
echo -e "\t[-d] enable dolby vision (default: ${DV_TOGGLE})"
|
echo -e "\t[-d] enable dolby vision (default: ${DV_TOGGLE})"
|
||||||
echo -e "\t[-v] Print relevant version info"
|
echo -e "\t[-v] Print relevant version info"
|
||||||
echo -e "\t[-s] use same container as input, default is mkv"
|
echo -e "\t[-s] use same container as input, default is convert to mkv"
|
||||||
echo -e "\n\t[output] if unset, defaults to ${HOME}/"
|
echo -e "\n\t[output] if unset, defaults to ${HOME}/"
|
||||||
echo -e "\n\t[-u] update script (git pull at ${REPO_DIR})"
|
echo -e "\n\t[-u] update script (git pull at ${REPO_DIR})"
|
||||||
echo -e "\t[-I] system install at ${ENCODE_INSTALL_PATH}"
|
echo -e "\t[-I] system install at ${ENCODE_INSTALL_PATH}"
|
||||||
@@ -163,7 +173,7 @@ set_encode_opts() {
|
|||||||
PRINT_OUT=false
|
PRINT_OUT=false
|
||||||
DV_TOGGLE=false
|
DV_TOGGLE=false
|
||||||
ENCODE_INSTALL_PATH='/usr/local/bin/encode'
|
ENCODE_INSTALL_PATH='/usr/local/bin/encode'
|
||||||
local sameContainer="false"
|
SAME_CONTAINER="false"
|
||||||
# only using -I/U
|
# only using -I/U
|
||||||
local minOpt=1
|
local minOpt=1
|
||||||
# using all + output name
|
# using all + output name
|
||||||
@@ -217,7 +227,7 @@ set_encode_opts() {
|
|||||||
optsUsed=$((optsUsed + 1))
|
optsUsed=$((optsUsed + 1))
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
sameContainer=true
|
SAME_CONTAINER=true
|
||||||
optsUsed=$((optsUsed + 1))
|
optsUsed=$((optsUsed + 1))
|
||||||
;;
|
;;
|
||||||
g)
|
g)
|
||||||
@@ -262,7 +272,7 @@ set_encode_opts() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# use same container for output
|
# use same container for output
|
||||||
if [[ $sameContainer == "true" ]]; then
|
if [[ $SAME_CONTAINER == "true" ]]; then
|
||||||
local fileFormat
|
local fileFormat
|
||||||
fileFormat="$(get_file_format "${INPUT}")" || return 1
|
fileFormat="$(get_file_format "${INPUT}")" || return 1
|
||||||
FILE_EXT=''
|
FILE_EXT=''
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ print_req_pkgs() {
|
|||||||
doxygen jq ccache gawk rust
|
doxygen jq ccache gawk rust
|
||||||
git gnuplot bison rsync ragel
|
git gnuplot bison rsync ragel
|
||||||
zip unzip gperf build-essential
|
zip unzip gperf build-essential
|
||||||
binutils ninja
|
binutils ninja ndk-multilib-native-static
|
||||||
)
|
)
|
||||||
|
|
||||||
local req_pkgs_env_name="${pkg_mgr/-/_}_pkgs"
|
local req_pkgs_env_name="${pkg_mgr/-/_}_pkgs"
|
||||||
|
|||||||
Reference in New Issue
Block a user