video2d-2x/scripts/common.lib

37 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2020-10-26 23:25:40 +00:00
#!/bin/bash
# This file is part of video2d-2x.
#
# video2d-2x is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2020-10-28 00:09:35 +00:00
DEF='\e[0m'; BLD='\e[1m'; RED='\e[31m'; GRN='\e[32m'; YLW='\e[33m'; WHT='\e[97m'
2020-10-26 23:25:40 +00:00
function clean_line () # $1: Fill size
{
2020-10-28 00:09:35 +00:00
printf "\r%$1s\r" ""
2020-10-26 23:25:40 +00:00
}
function framerate ()
{
local StreamCount=$(jq -r '.format.nb_streams' "$FormatJson")
for (( Index=0; Index < StreamCount; Index++ ))
do
if [[ $(jq -r ".streams[$Index].codec_type" "$StreamsJson") == "video" ]]; then
jq -r ".streams[$Index].r_frame_rate" "$StreamsJson"
2020-10-28 00:09:35 +00:00
break
2020-10-26 23:25:40 +00:00
fi
done
}