video2d-2x/scripts/common.lib
2020-10-28 03:09:35 +03:00

37 lines
1.1 KiB
Bash

#!/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/>.
DEF='\e[0m'; BLD='\e[1m'; RED='\e[31m'; GRN='\e[32m'; YLW='\e[33m'; WHT='\e[97m'
function clean_line () # $1: Fill size
{
printf "\r%$1s\r" ""
}
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"
break
fi
done
}