From ed963cbb376339597f377aea07a94869ee89954b Mon Sep 17 00:00:00 2001 From: q3aql Date: Tue, 9 Mar 2021 13:01:11 +0100 Subject: [PATCH] Change tracks 5.1/7.1 to stereo (ks-mp3/oga-album) --- src/ks-mp3-album | 11 ++++++++++- src/ks-oga-album | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ks-mp3-album b/src/ks-mp3-album index 50461f4..f45bd90 100755 --- a/src/ks-mp3-album +++ b/src/ks-mp3-album @@ -285,7 +285,16 @@ else artist_title="${artist_file}" artist_init="${artist_file}" fi - ffmpeg -i "${show_file}" -map ${audio_track} -c:a ${acodec} -b:a ${b_acodec} -metadata title="${name_title}" -metadata date="${year_num}" -metadata genre="${genre_file}" -metadata album="${album_title}" -metadata artist="${artist_title}" -metadata track="${track_num}" "to-mp3/${fname}.${v_ext}" + # Check audio 5.1 or 7.1 + audio_5_7_1=$(${p_ffmpeg} "${show_file}" 2>&1 | grep Stream | tr -s " " | grep "Audio:" | grep "${audio_track}" | grep -i "5.1") + audio_5_7_1_2=$(${p_ffmpeg} "${show_file}" 2>&1 | grep Stream | tr -s " " | grep "Audio:" | grep "${audio_track}" | grep -i "7.1") + audio_5_7_1="${audio_5_7_1}${audio_5_7_1_2}" + if [ -z "${audio_5_7_1}" ] ; then + stereo_params="-ac 2" + else + stereo_params="-ac 2 -clev 3dB -slev -6dB" + fi + ffmpeg -i "${show_file}" -map ${audio_track} -c:a ${acodec} -b:a ${b_acodec} ${stereo_params} -metadata title="${name_title}" -metadata date="${year_num}" -metadata genre="${genre_file}" -metadata album="${album_title}" -metadata artist="${artist_title}" -metadata track="${track_num}" "to-mp3/${fname}.${v_ext}" # Increment variables convert_files=$(expr ${convert_files} + 1) track_init=$(expr ${track_num} + 1) diff --git a/src/ks-oga-album b/src/ks-oga-album index 9554021..a6c6a5f 100755 --- a/src/ks-oga-album +++ b/src/ks-oga-album @@ -285,7 +285,16 @@ else artist_title="${artist_file}" artist_init="${artist_file}" fi - ffmpeg -i "${show_file}" -map ${audio_track} -c:a ${acodec} -b:a ${b_acodec} -metadata title="${name_title}" -metadata date="${year_num}" -metadata genre="${genre_file}" -metadata album="${album_title}" -metadata artist="${artist_title}" -metadata track="${track_num}" "to-oga/${fname}.${v_ext}" + # Check audio 5.1 or 7.1 + audio_5_7_1=$(${p_ffmpeg} "${show_file}" 2>&1 | grep Stream | tr -s " " | grep "Audio:" | grep "${audio_track}" | grep -i "5.1") + audio_5_7_1_2=$(${p_ffmpeg} "${show_file}" 2>&1 | grep Stream | tr -s " " | grep "Audio:" | grep "${audio_track}" | grep -i "7.1") + audio_5_7_1="${audio_5_7_1}${audio_5_7_1_2}" + if [ -z "${audio_5_7_1}" ] ; then + stereo_params="-ac 2" + else + stereo_params="-ac 2 -clev 3dB -slev -6dB" + fi + ffmpeg -i "${show_file}" -map ${audio_track} -c:a ${acodec} -b:a ${b_acodec} ${stereo_params} -metadata title="${name_title}" -metadata date="${year_num}" -metadata genre="${genre_file}" -metadata album="${album_title}" -metadata artist="${artist_title}" -metadata track="${track_num}" "to-oga/${fname}.${v_ext}" # Increment variables convert_files=$(expr ${convert_files} + 1) track_init=$(expr ${track_num} + 1)