Fix detect resolution with two or more video tracks

This commit is contained in:
q3aql 2023-05-26 18:36:36 +02:00
parent 6fc7c1a692
commit d4cc9909ee
6 changed files with 24 additions and 24 deletions

View File

@ -2,12 +2,12 @@
################################################## ##################################################
# ks-av1 (ks-tools) - Convert video to AV1 codec # # ks-av1 (ks-tools) - Convert video to AV1 codec #
# Date: 22-05-2023 # # Date: 26-05-2023 #
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
################################################## ##################################################
VERSION="8.5-dev" VERSION="8.5-dev"
M_DATE="220523" M_DATE="260523"
# Detect version ffmpeg for old releases # Detect version ffmpeg for old releases
ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1)
@ -61,7 +61,7 @@ function set_resolution() {
fi fi
done done
if [ ${bc_found} -eq 0 ] ; then if [ ${bc_found} -eq 0 ] ; then
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}') file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}' | head -1)
if [ -z "${file_rel}" ] ; then if [ -z "${file_rel}" ] ; then
echo ${set_rel} echo ${set_rel}
else else
@ -135,7 +135,7 @@ fi
# Check if ffmpeg is installed # Check if ffmpeg is installed
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
dependencies="ffmpeg grep sed grep cut head tail tr cat" dependencies="ffmpeg grep sed grep cut head tail tr cat bc"
dependencies_found="" dependencies_found=""
dependencies_not_found="" dependencies_not_found=""
for checkPath in ${path_check} ; do for checkPath in ${path_check} ; do

View File

@ -2,12 +2,12 @@
############################################################ ############################################################
# ks-av1s (ks-tools) - Convert video to AV1 codec (Series) # # ks-av1s (ks-tools) - Convert video to AV1 codec (Series) #
# Date: 22-05-2023 # # Date: 26-05-2023 #
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
############################################################ ############################################################
VERSION="8.5-dev" VERSION="8.5-dev"
M_DATE="220523" M_DATE="260523"
# Detect version ffmpeg for old releases # Detect version ffmpeg for old releases
ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1)
@ -61,7 +61,7 @@ function set_resolution() {
fi fi
done done
if [ ${bc_found} -eq 0 ] ; then if [ ${bc_found} -eq 0 ] ; then
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}') file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}' | head -1)
if [ -z "${file_rel}" ] ; then if [ -z "${file_rel}" ] ; then
echo ${set_rel} echo ${set_rel}
else else
@ -135,7 +135,7 @@ fi
# Check if ffmpeg is installed # Check if ffmpeg is installed
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
dependencies="ffmpeg grep sed grep cut head tail tr cat" dependencies="ffmpeg grep sed grep cut head tail tr cat bc"
dependencies_found="" dependencies_found=""
dependencies_not_found="" dependencies_not_found=""
for checkPath in ${path_check} ; do for checkPath in ${path_check} ; do

View File

@ -2,12 +2,12 @@
############################################################### ###############################################################
# ks-avi (ks-tools) - Convert video to AVI format # # ks-avi (ks-tools) - Convert video to AVI format #
# Date: 22-05-2023 # # Date: 26-05-2023 #
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
############################################################### ###############################################################
VERSION="8.5-dev" VERSION="8.5-dev"
M_DATE="220523" M_DATE="260523"
# Detect version ffmpeg for old releases # Detect version ffmpeg for old releases
ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1)
@ -64,7 +64,7 @@ function set_resolution() {
fi fi
done done
if [ ${bc_found} -eq 0 ] ; then if [ ${bc_found} -eq 0 ] ; then
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}') file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}' | head -1)
if [ -z "${file_rel}" ] ; then if [ -z "${file_rel}" ] ; then
echo ${set_rel} echo ${set_rel}
else else
@ -143,7 +143,7 @@ fi
# Check if ffmpeg is installed # Check if ffmpeg is installed
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
dependencies="ffmpeg grep sed grep cut head tail tr cat" dependencies="ffmpeg grep sed grep cut head tail tr cat bc"
dependencies_found="" dependencies_found=""
dependencies_not_found="" dependencies_not_found=""
for checkPath in ${path_check} ; do for checkPath in ${path_check} ; do

View File

@ -2,12 +2,12 @@
############################################################### ###############################################################
# ks-mp4 (ks-tools) - Convert video to MP4 format # # ks-mp4 (ks-tools) - Convert video to MP4 format #
# Date: 22-05-2023 # # Date: 26-05-2023 #
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
############################################################### ###############################################################
VERSION="8.5-dev" VERSION="8.5-dev"
M_DATE="220523" M_DATE="260523"
# Detect version ffmpeg for old releases # Detect version ffmpeg for old releases
ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1)
@ -64,7 +64,7 @@ function set_resolution() {
fi fi
done done
if [ ${bc_found} -eq 0 ] ; then if [ ${bc_found} -eq 0 ] ; then
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}') file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}' | head -1)
if [ -z "${file_rel}" ] ; then if [ -z "${file_rel}" ] ; then
echo ${set_rel} echo ${set_rel}
else else
@ -143,7 +143,7 @@ fi
# Check if ffmpeg is installed # Check if ffmpeg is installed
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
dependencies="ffmpeg grep sed grep cut head tail tr cat" dependencies="ffmpeg grep sed grep cut head tail tr cat bc"
dependencies_found="" dependencies_found=""
dependencies_not_found="" dependencies_not_found=""
for checkPath in ${path_check} ; do for checkPath in ${path_check} ; do

View File

@ -2,12 +2,12 @@
############################################################### ###############################################################
# ks-mp4k (ks-tools) - Convert video to MP4 format (4K) # # ks-mp4k (ks-tools) - Convert video to MP4 format (4K) #
# Date: 22-05-2023 # # Date: 26-05-2023 #
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
############################################################### ###############################################################
VERSION="8.5-dev" VERSION="8.5-dev"
M_DATE="220523" M_DATE="260523"
# Detect version ffmpeg for old releases # Detect version ffmpeg for old releases
ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1)
@ -64,7 +64,7 @@ function set_resolution() {
fi fi
done done
if [ ${bc_found} -eq 0 ] ; then if [ ${bc_found} -eq 0 ] ; then
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}') file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}' | head -1)
if [ -z "${file_rel}" ] ; then if [ -z "${file_rel}" ] ; then
echo ${set_rel} echo ${set_rel}
else else
@ -143,7 +143,7 @@ fi
# Check if ffmpeg is installed # Check if ffmpeg is installed
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
dependencies="ffmpeg grep sed grep cut head tail tr cat" dependencies="ffmpeg grep sed grep cut head tail tr cat bc"
dependencies_found="" dependencies_found=""
dependencies_not_found="" dependencies_not_found=""
for checkPath in ${path_check} ; do for checkPath in ${path_check} ; do

View File

@ -2,12 +2,12 @@
############################################################### ###############################################################
# ks-mp4s (ks-tools) - Convert video to MP4 format (Series) # # ks-mp4s (ks-tools) - Convert video to MP4 format (Series) #
# Date: 22-05-2023 # # Date: 26-05-2023 #
# Author: q3aql # # Author: q3aql #
# Contact: q3aql@duck.com # # Contact: q3aql@duck.com #
############################################################### ###############################################################
VERSION="8.5-dev" VERSION="8.5-dev"
M_DATE="220523" M_DATE="260523"
# Detect version ffmpeg for old releases # Detect version ffmpeg for old releases
ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1)
@ -64,7 +64,7 @@ function set_resolution() {
fi fi
done done
if [ ${bc_found} -eq 0 ] ; then if [ ${bc_found} -eq 0 ] ; then
file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}') file_rel=$(ffmpeg -i "${2}" 2>&1 | grep Stream | grep Video: | grep -Po '\d{3,5}x\d{3,5}' | head -1)
if [ -z "${file_rel}" ] ; then if [ -z "${file_rel}" ] ; then
echo ${set_rel} echo ${set_rel}
else else
@ -143,7 +143,7 @@ fi
# Check if ffmpeg is installed # Check if ffmpeg is installed
path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin" path_check="/usr/bin /bin /usr/local/bin ${HOME}/.local/bin"
dependencies="ffmpeg grep sed grep cut head tail tr cat" dependencies="ffmpeg grep sed grep cut head tail tr cat bc"
dependencies_found="" dependencies_found=""
dependencies_not_found="" dependencies_not_found=""
for checkPath in ${path_check} ; do for checkPath in ${path_check} ; do