diff --git a/src/ks-avi b/src/ks-avi index d875fca..3d98f73 100755 --- a/src/ks-avi +++ b/src/ks-avi @@ -2,12 +2,27 @@ ############################################################### # ks-avi (ks-tools) - Convert video to AVI format # -# Date: 04-02-2022 # +# Date: 10-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="040222" +M_DATE="100223" + +# Detect version ffmpeg for old releases +ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) +IFS="abcdefghijklmnopqrstyvwxzABCDEFHIJKLMNOPQRSTYVWXZ@/()" +ffmpeg_version=$(echo ${ffmpeg_version}) +IFS="" +if [ -z "${ffmpeg_version}" ] ; then + video_sync="vsync" +else + if [ ${ffmpeg_version} -lt 5 ] ; then + video_sync="vsync" + else + video_sync="fps_mode" + fi +fi # Global parameters dirTemp="/tmp" @@ -198,8 +213,8 @@ fi p_ffmpeg="ffmpeg -i" p_ffmpeg_patched="-max_muxing_queue_size 9999" # f_conversion="-vsync 1 -async 1" # Deprecated method -#f_conversion="-fps_mode cfr -af aresample=async=1:min_hard_comp=0.100000:first_pts=0" -f_conversion="-fps_mode cfr -af aresample=async=1" +#f_conversion="-${video_sync} cfr -af aresample=async=1:min_hard_comp=0.100000:first_pts=0" +f_conversion="-${video_sync} cfr -af aresample=async=1" # Check if video input uses H265 (HEVC) codec_h265=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "h265") codec_hevc=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "hevc") diff --git a/src/ks-crop b/src/ks-crop index 01d2c14..30cb3e3 100755 --- a/src/ks-crop +++ b/src/ks-crop @@ -2,12 +2,27 @@ ############################################################### # ks-crop (ks-tools) - Crop or change aspect ratio of a video # -# Date: 08-02-2023 # +# Date: 10-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="080223" +M_DATE="100223" + +# Detect version ffmpeg for old releases +ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) +IFS="abcdefghijklmnopqrstyvwxzABCDEFHIJKLMNOPQRSTYVWXZ@/()" +ffmpeg_version=$(echo ${ffmpeg_version}) +IFS="" +if [ -z "${ffmpeg_version}" ] ; then + video_sync="vsync" +else + if [ ${ffmpeg_version} -lt 5 ] ; then + video_sync="vsync" + else + video_sync="fps_mode" + fi +fi # Global parameters dirTemp="/tmp" @@ -137,8 +152,8 @@ function errorReadingFile() { p_ffmpeg="ffmpeg -i" p_ffmpeg_patched="-max_muxing_queue_size 9999" # f_conversion="-vsync 1 -async 1" # Deprecated method -f_conversion="-fps_mode cfr" -f_conversion_crop="-fps_mode cfr -async 1" +f_conversion="-${video_sync} cfr" +f_conversion_crop="-${video_sync} cfr -async 1" # Check if video input uses H265 (HEVC) codec_h265=$(${p_ffmpeg} "${2}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "h265") codec_hevc=$(${p_ffmpeg} "${2}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "hevc") diff --git a/src/ks-mix b/src/ks-mix index 573edfd..02d3340 100755 --- a/src/ks-mix +++ b/src/ks-mix @@ -2,12 +2,27 @@ ##################################################################### # ks-mix (ks-tools) - Extract video/audio and mix video/audio files # -# Date: 08-02-2023 # +# Date: 10-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ##################################################################### VERSION="8.4-dev" -M_DATE="080223" +M_DATE="100223" + +# Detect version ffmpeg for old releases +ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) +IFS="abcdefghijklmnopqrstyvwxzABCDEFHIJKLMNOPQRSTYVWXZ@/()" +ffmpeg_version=$(echo ${ffmpeg_version}) +IFS="" +if [ -z "${ffmpeg_version}" ] ; then + video_sync="vsync" +else + if [ ${ffmpeg_version} -lt 5 ] ; then + video_sync="vsync" + else + video_sync="fps_mode" + fi +fi # File(s) detection current_dir="$(pwd)" @@ -135,7 +150,7 @@ elif [ "${1}" == "-evid" ] ; then echo -n "* Starting extract video track (${2}) " sleep 3 ffmpeg -y -i "${2}" -map ${video_track} -c:v copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir}" sleep 2 @@ -208,7 +223,7 @@ elif [ "${1}" == "-ev25" ] ; then if [ "${codec_encoded}" == "h264_encoded" ] ; then ffmpeg -y -i "${2}" -map ${video_track} -c copy -f h264 "${current_dir}/seeing_noaudio.h264" ffmpeg -y -r 25 -i "${current_dir}/seeing_noaudio.h264" -c copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir} (25 fps)" sleep 2 @@ -221,7 +236,7 @@ elif [ "${1}" == "-ev25" ] ; then ffmpeg -y -i "${current_dir}/temp-h265.mkv" -c copy -f h264 "${current_dir}/seeing_noaudio.h264" rm -rf "${current_dir}/temp-h265.mkv" ffmpeg -y -r 25 -i "${current_dir}/seeing_noaudio.h264" -c copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir} (25 fps)" sleep 2 @@ -235,7 +250,7 @@ elif [ "${1}" == "-ev25" ] ; then ffmpeg -y -i "${current_dir}/temp-h265.mkv" -c copy -f h264 "${current_dir}/seeing_noaudio.h264" rm -rf "${current_dir}/temp-h265.mkv" ffmpeg -y -r 25 -i "${current_dir}/seeing_noaudio.h264" -c copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir} (25 fps)" sleep 2 @@ -248,7 +263,7 @@ elif [ "${1}" == "-ev25" ] ; then ffmpeg -y -i "${current_dir}/temp-mpeg4.mkv" -c copy -f h264 "${current_dir}/seeing_noaudio.h264" rm -rf "${current_dir}/temp-mpeg4.mkv" ffmpeg -y -r 25 -i "${current_dir}/seeing_noaudio.h264" -c copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir} (25 fps)" sleep 2 @@ -330,7 +345,7 @@ elif [ "${1}" == "-evpf" ] ; then if [ "${codec_encoded}" == "h264_encoded" ] ; then ffmpeg -y -i "${2}" -map ${video_track} -c copy -f h264 "${current_dir}/seeing_noaudio.h264" ffmpeg -y -r ${frames_default} -i "${current_dir}/seeing_noaudio.h264" -c copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir} (25 fps)" sleep 2 @@ -343,7 +358,7 @@ elif [ "${1}" == "-evpf" ] ; then ffmpeg -y -i "${current_dir}/temp-h265.mkv" -c copy -f h264 "${current_dir}/seeing_noaudio.h264" rm -rf "${current_dir}/temp-h265.mkv" ffmpeg -y -r ${frames_default} -i "${current_dir}/seeing_noaudio.h264" -c copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir} (25 fps)" sleep 2 @@ -357,7 +372,7 @@ elif [ "${1}" == "-evpf" ] ; then ffmpeg -y -i "${current_dir}/temp-h265.mkv" -c copy -f h264 "${current_dir}/seeing_noaudio.h264" rm -rf "${current_dir}/temp-h265.mkv" ffmpeg -y -r 25 -i "${current_dir}/seeing_noaudio.h264" -c copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir} (25 fps)" sleep 2 @@ -370,7 +385,7 @@ elif [ "${1}" == "-evpf" ] ; then ffmpeg -y -i "${current_dir}/temp-mpeg4.mkv" -c copy -f h264 "${current_dir}/seeing_noaudio.h264" rm -rf "${current_dir}/temp-mpeg4.mkv" ffmpeg -y -r ${frames_default} -i "${current_dir}/seeing_noaudio.h264" -c copy "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir} (25 fps)" sleep 2 @@ -613,7 +628,7 @@ elif [ "${1}" == "-evti" ] ; then echo -n "* Starting extract video track (${2}) " sleep 3 ffmpeg -y -i "${2}" -map ${video_track} -c:v copy -ss ${hourCut}:${minuteCut}:${secondCut} "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir}" sleep 2 @@ -723,7 +738,7 @@ elif [ "${1}" == "-evti" ] ; then echo -n "* Starting extract video track (${2}) " sleep 3 ffmpeg -y -i "${2}" -map ${video_track} -c:v copy -ss ${hourCut}:${minuteCut}:${secondCut} -t ${hourCutAfter}:${minuteCutAfter}:${secondCutAfter} "${current_dir}/seeing.mp4" - ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -fps_mode cfr -c:v copy "${video_file_dir}" + ffmpeg -y -i "${current_dir}/seeing.mp4" -map 0:0 -${video_sync} cfr -c:v copy "${video_file_dir}" echo "" echo -n "* Extracted video into ${video_file_dir}" sleep 2 diff --git a/src/ks-mp4 b/src/ks-mp4 index 94f0ba3..76d7f30 100755 --- a/src/ks-mp4 +++ b/src/ks-mp4 @@ -2,12 +2,27 @@ ############################################################### # ks-mp4 (ks-tools) - Convert video to MP4 format # -# Date: 08-02-2023 # +# Date: 10-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="080223" +M_DATE="100223" + +# Detect version ffmpeg for old releases +ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) +IFS="abcdefghijklmnopqrstyvwxzABCDEFHIJKLMNOPQRSTYVWXZ@/()" +ffmpeg_version=$(echo ${ffmpeg_version}) +IFS="" +if [ -z "${ffmpeg_version}" ] ; then + video_sync="vsync" +else + if [ ${ffmpeg_version} -lt 5 ] ; then + video_sync="vsync" + else + video_sync="fps_mode" + fi +fi # Global parameters dirTemp="/tmp" @@ -198,8 +213,8 @@ fi p_ffmpeg="ffmpeg -i" p_ffmpeg_patched="-max_muxing_queue_size 9999" # f_conversion="-vsync 1 -async 1" # Deprecated method -#f_conversion="-fps_mode cfr -af aresample=async=1:min_hard_comp=0.100000:first_pts=0" -f_conversion="-fps_mode cfr -af aresample=async=1" +#f_conversion="-${video_sync} cfr -af aresample=async=1:min_hard_comp=0.100000:first_pts=0" +f_conversion="-${video_sync} cfr -af aresample=async=1" # Check if video input uses H265 (HEVC) codec_h265=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "h265") codec_hevc=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "hevc") diff --git a/src/ks-mp4k b/src/ks-mp4k index a8c8062..e3122c7 100755 --- a/src/ks-mp4k +++ b/src/ks-mp4k @@ -2,12 +2,27 @@ ############################################################### # ks-mp4k (ks-tools) - Convert video to MP4 format (4K) # -# Date: 08-02-2023 # +# Date: 10-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="080223" +M_DATE="100223" + +# Detect version ffmpeg for old releases +ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) +IFS="abcdefghijklmnopqrstyvwxzABCDEFHIJKLMNOPQRSTYVWXZ@/()" +ffmpeg_version=$(echo ${ffmpeg_version}) +IFS="" +if [ -z "${ffmpeg_version}" ] ; then + video_sync="vsync" +else + if [ ${ffmpeg_version} -lt 5 ] ; then + video_sync="vsync" + else + video_sync="fps_mode" + fi +fi # Global parameters dirTemp="/tmp" @@ -198,8 +213,8 @@ fi p_ffmpeg="ffmpeg -i" p_ffmpeg_patched="-max_muxing_queue_size 9999" # f_conversion="-vsync 1 -async 1" # Deprecated method -#f_conversion="-fps_mode cfr -af aresample=async=1:min_hard_comp=0.100000:first_pts=0" -f_conversion="-fps_mode cfr -af aresample=async=1" +#f_conversion="-${video_sync} cfr -af aresample=async=1:min_hard_comp=0.100000:first_pts=0" +f_conversion="-${video_sync} cfr -af aresample=async=1" # Check if video input uses H265 (HEVC) codec_h265=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "h265") codec_hevc=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "hevc") diff --git a/src/ks-mp4s b/src/ks-mp4s index 392b94f..a5df4bc 100755 --- a/src/ks-mp4s +++ b/src/ks-mp4s @@ -2,12 +2,27 @@ ############################################################### # ks-mp4s (ks-tools) - Convert video to MP4 format (Series) # -# Date: 08-02-2023 # +# Date: 10-02-2023 # # Author: q3aql # # Contact: q3aql@duck.com # ############################################################### VERSION="8.4-dev" -M_DATE="080223" +M_DATE="100223" + +# Detect version ffmpeg for old releases +ffmpeg_version=$(ffmpeg -version 2>&1 | grep version | head -1 | cut -d " " -f 3 | cut -d "." -f 1) +IFS="abcdefghijklmnopqrstyvwxzABCDEFHIJKLMNOPQRSTYVWXZ@/()" +ffmpeg_version=$(echo ${ffmpeg_version}) +IFS="" +if [ -z "${ffmpeg_version}" ] ; then + video_sync="vsync" +else + if [ ${ffmpeg_version} -lt 5 ] ; then + video_sync="vsync" + else + video_sync="fps_mode" + fi +fi # Global parameters dirTemp="/tmp" @@ -198,8 +213,8 @@ fi p_ffmpeg="ffmpeg -i" p_ffmpeg_patched="-max_muxing_queue_size 9999" # f_conversion="-vsync 1 -async 1" # Deprecated method -#f_conversion="-fps_mode cfr -af aresample=async=1:min_hard_comp=0.100000:first_pts=0" -f_conversion="-fps_mode cfr -af aresample=async=1" +#f_conversion="-${video_sync} cfr -af aresample=async=1:min_hard_comp=0.100000:first_pts=0" +f_conversion="-${video_sync} cfr -af aresample=async=1" # Check if video input uses H265 (HEVC) codec_h265=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "h265") codec_hevc=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Video:" | grep "hevc")