diff --git a/src/images_to_video.sh b/src/images_to_video.sh old mode 100644 new mode 100755 index c0f4568..f31b6aa --- a/src/images_to_video.sh +++ b/src/images_to_video.sh @@ -15,5 +15,8 @@ echo $WIDTH x $HEIGHT # Center all the images and pad them to the larger width and height # Set the border color to the dominant color of the image for f in $FILES; do - convert $f -gravity center -background none -extent ${WIDTH}x${HEIGHT} -bordercolor $(convert $f -format "%[pixel:p{0,0}]" info:) -border 0x0 $f + BORDER_COLOR=$(convert $f -format "%[pixel:p{0,0}]" info:) + echo "Border color: $BORDER_COLOR" + # BORDER_COLOR="srgb(255,255,255)" + convert $f -gravity center -background none -extent ${WIDTH}x${HEIGHT} -bordercolor $BORDER_COLOR -border 0x0 $f done \ No newline at end of file diff --git a/src/mscz_to_mp3.py b/src/mscz_to_mp3.py index df6ef7f..13a88a3 100644 --- a/src/mscz_to_mp3.py +++ b/src/mscz_to_mp3.py @@ -74,9 +74,7 @@ def create_audios(files, dest="out"): print(f"Converted {basename(el)}.mp3") -def __main__(): - SCORE=sys.argv[1] - OUT=sys.argv[2] +def __main__(SCORE, OUT): os.makedirs(OUT, exist_ok=True) if SCORE.split(".")[-1] == "mscz": @@ -104,4 +102,8 @@ def __main__(): if __name__ == "__main__": - __main__() \ No newline at end of file + if len(sys.argv) < 3: + print(f"Usage: {sys.argv[0]} ") + exit(1) + + __main__(sys.argv[1], sys.argv[2]) \ No newline at end of file diff --git a/src/set_audio.sh b/src/set_audio.sh index 2e384c6..9714ef2 100755 --- a/src/set_audio.sh +++ b/src/set_audio.sh @@ -11,6 +11,7 @@ IN=$1 AUDIOS=out OUT=videos mkdir -p "$OUT" +BASE_NAME="instrument_" add_audio () { ffmpeg -y \ @@ -22,7 +23,7 @@ add_audio () { $3 } -add_audio "$IN" "$AUDIOS/instrument_1.mp3" "$OUT/soprane.mkv" -add_audio "$IN" "$AUDIOS/instrument_2.mp3" "$OUT/alti.mkv" -add_audio "$IN" "$AUDIOS/instrument_3.mp3" "$OUT/tenor.mkv" -add_audio "$IN" "$AUDIOS/instrument_4.mp3" "$OUT/basse.mkv" +add_audio "$IN" "$AUDIOS/${BASE_NAME}1.mp3" "$OUT/soprane.mkv" +add_audio "$IN" "$AUDIOS/${BASE_NAME}2.mp3" "$OUT/alti.mkv" +add_audio "$IN" "$AUDIOS/${BASE_NAME}3.mp3" "$OUT/tenor.mkv" +add_audio "$IN" "$AUDIOS/${BASE_NAME}4.mp3" "$OUT/basse.mkv" diff --git a/src/superpose_audios.sh b/src/superpose_audios.sh new file mode 100755 index 0000000..ec27217 --- /dev/null +++ b/src/superpose_audios.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +AUDIOS=out +BASE_NAME="instrument_" +BASE_OUT_NAME="combined_" +VOLUME_2="0.1" + + +combine () { + ffmpeg -y \ + -i $1 \ + -i $2 \ + -filter_complex \ + "[0:a]volume=1.0[a1];[1:a]volume=${VOLUME_2}[a2];[a1][a2]amix=inputs=2:duration=first" \ + $3 +} + +input_file () { + echo "${AUDIOS}/${BASE_NAME}$1.mp3" +} + +output_file () { + echo "${AUDIOS}/${BASE_OUT_NAME}$1.mp3" +} + +combine "$(input_file 1)" "$(input_file 3)" "$(output_file 1)" +combine "$(input_file 2)" "$(input_file 3)" "$(output_file 2)" +combine "$(input_file 3)" "$(input_file 1)" "$(output_file 3)" +combine "$(input_file 4)" "$(input_file 1)" "$(output_file 4)"