From d4cc9909eea71fa84d4d7a4a8525b48cf314c2a5 Mon Sep 17 00:00:00 2001 From: q3aql Date: Fri, 26 May 2023 18:36:36 +0200 Subject: [PATCH] Fix detect resolution with two or more video tracks --- src/ks-av1 | 8 ++++---- src/ks-av1s | 8 ++++---- src/ks-avi | 8 ++++---- src/ks-mp4 | 8 ++++---- src/ks-mp4k | 8 ++++---- src/ks-mp4s | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/ks-av1 b/src/ks-av1 index ff332c2..75c9239 100755 --- a/src/ks-av1 +++ b/src/ks-av1 @@ -2,12 +2,12 @@ ################################################## # ks-av1 (ks-tools) - Convert video to AV1 codec # -# Date: 22-05-2023 # +# Date: 26-05-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ################################################## VERSION="8.5-dev" -M_DATE="220523" +M_DATE="260523" # Detect version ffmpeg for old releases 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 done 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 echo ${set_rel} else @@ -135,7 +135,7 @@ fi # Check if ffmpeg is installed 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_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-av1s b/src/ks-av1s index 78aa22f..f2604ca 100755 --- a/src/ks-av1s +++ b/src/ks-av1s @@ -2,12 +2,12 @@ ############################################################ # ks-av1s (ks-tools) - Convert video to AV1 codec (Series) # -# Date: 22-05-2023 # +# Date: 26-05-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################ VERSION="8.5-dev" -M_DATE="220523" +M_DATE="260523" # Detect version ffmpeg for old releases 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 done 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 echo ${set_rel} else @@ -135,7 +135,7 @@ fi # Check if ffmpeg is installed 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_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-avi b/src/ks-avi index 9e90576..4ddaff0 100755 --- a/src/ks-avi +++ b/src/ks-avi @@ -2,12 +2,12 @@ ############################################################### # ks-avi (ks-tools) - Convert video to AVI format # -# Date: 22-05-2023 # +# Date: 26-05-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.5-dev" -M_DATE="220523" +M_DATE="260523" # Detect version ffmpeg for old releases 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 done 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 echo ${set_rel} else @@ -143,7 +143,7 @@ fi # Check if ffmpeg is installed 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_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-mp4 b/src/ks-mp4 index 227c176..2d07011 100755 --- a/src/ks-mp4 +++ b/src/ks-mp4 @@ -2,12 +2,12 @@ ############################################################### # ks-mp4 (ks-tools) - Convert video to MP4 format # -# Date: 22-05-2023 # +# Date: 26-05-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.5-dev" -M_DATE="220523" +M_DATE="260523" # Detect version ffmpeg for old releases 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 done 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 echo ${set_rel} else @@ -143,7 +143,7 @@ fi # Check if ffmpeg is installed 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_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-mp4k b/src/ks-mp4k index 1cd563b..8f43d3c 100755 --- a/src/ks-mp4k +++ b/src/ks-mp4k @@ -2,12 +2,12 @@ ############################################################### # ks-mp4k (ks-tools) - Convert video to MP4 format (4K) # -# Date: 22-05-2023 # +# Date: 26-05-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.5-dev" -M_DATE="220523" +M_DATE="260523" # Detect version ffmpeg for old releases 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 done 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 echo ${set_rel} else @@ -143,7 +143,7 @@ fi # Check if ffmpeg is installed 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_not_found="" for checkPath in ${path_check} ; do diff --git a/src/ks-mp4s b/src/ks-mp4s index eeecb2f..065721f 100755 --- a/src/ks-mp4s +++ b/src/ks-mp4s @@ -2,12 +2,12 @@ ############################################################### # ks-mp4s (ks-tools) - Convert video to MP4 format (Series) # -# Date: 22-05-2023 # +# Date: 26-05-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.5-dev" -M_DATE="220523" +M_DATE="260523" # Detect version ffmpeg for old releases 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 done 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 echo ${set_rel} else @@ -143,7 +143,7 @@ fi # Check if ffmpeg is installed 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_not_found="" for checkPath in ${path_check} ; do