diff --git a/src/ks-mp3 b/src/ks-mp3 index efcf2ff..06f5259 100755 --- a/src/ks-mp3 +++ b/src/ks-mp3 @@ -246,13 +246,23 @@ else else genre_file="${genre_file}" fi + + # Check audio 5.1 or 7.1 + audio_5_7_1=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Audio:" | grep "${audio_track}" | grep -i "5.1") + audio_5_7_1_2=$(${p_ffmpeg} "${1}" 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 # Show commands for conversion echo "" echo "* COMMANDS THAT WILL BE EXECUTED:" echo "" echo " # Convert the file '${1}' to MP3 Audio" - echo " ${p_ffmpeg} \"${1}\" -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}\" \"${2}.${v_ext}\"" + echo " ${p_ffmpeg} \"${1}\" -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}\" \"${2}.${v_ext}\"" # Execute commands for conversion echo "" @@ -260,6 +270,6 @@ else if [ "${run_commands_ffmpeg}" == "n" ] ; then exit else - ${p_ffmpeg} "${1}" -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}" "${2}.${v_ext}" + ${p_ffmpeg} "${1}" -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}" "${2}.${v_ext}" fi fi diff --git a/src/ks-oga b/src/ks-oga index 44c256c..6c5d574 100755 --- a/src/ks-oga +++ b/src/ks-oga @@ -246,13 +246,23 @@ else else genre_file="${genre_file}" fi + + # Check audio 5.1 or 7.1 + audio_5_7_1=$(${p_ffmpeg} "${1}" 2>&1 | grep Stream | tr -s " " | grep "Audio:" | grep "${audio_track}" | grep -i "5.1") + audio_5_7_1_2=$(${p_ffmpeg} "${1}" 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 # Show commands for conversion echo "" echo "* COMMANDS THAT WILL BE EXECUTED:" echo "" echo " # Convert the file '${1}' to OGG Audio" - echo " ${p_ffmpeg} \"${1}\" -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}\" \"${2}.${v_ext}\"" + echo " ${p_ffmpeg} \"${1}\" -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}\" \"${2}.${v_ext}\"" # Execute commands for conversion echo "" @@ -260,6 +270,6 @@ else if [ "${run_commands_ffmpeg}" == "n" ] ; then exit else - ${p_ffmpeg} "${1}" -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}" "${2}.${v_ext}" + ${p_ffmpeg} "${1}" -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}" "${2}.${v_ext}" fi fi