Add superpose_audios.sh
This commit is contained in:
parent
8adea8f37d
commit
bb4a9485df
5
src/images_to_video.sh
Normal file → Executable file
5
src/images_to_video.sh
Normal file → Executable file
@ -15,5 +15,8 @@ echo $WIDTH x $HEIGHT
|
|||||||
# Center all the images and pad them to the larger width and 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
|
# Set the border color to the dominant color of the image
|
||||||
for f in $FILES; do
|
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
|
done
|
@ -74,9 +74,7 @@ def create_audios(files, dest="out"):
|
|||||||
print(f"Converted {basename(el)}.mp3")
|
print(f"Converted {basename(el)}.mp3")
|
||||||
|
|
||||||
|
|
||||||
def __main__():
|
def __main__(SCORE, OUT):
|
||||||
SCORE=sys.argv[1]
|
|
||||||
OUT=sys.argv[2]
|
|
||||||
os.makedirs(OUT, exist_ok=True)
|
os.makedirs(OUT, exist_ok=True)
|
||||||
|
|
||||||
if SCORE.split(".")[-1] == "mscz":
|
if SCORE.split(".")[-1] == "mscz":
|
||||||
@ -104,4 +102,8 @@ def __main__():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
__main__()
|
if len(sys.argv) < 3:
|
||||||
|
print(f"Usage: {sys.argv[0]} <file.mscz> <out/>")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
__main__(sys.argv[1], sys.argv[2])
|
@ -11,6 +11,7 @@ IN=$1
|
|||||||
AUDIOS=out
|
AUDIOS=out
|
||||||
OUT=videos
|
OUT=videos
|
||||||
mkdir -p "$OUT"
|
mkdir -p "$OUT"
|
||||||
|
BASE_NAME="instrument_"
|
||||||
|
|
||||||
add_audio () {
|
add_audio () {
|
||||||
ffmpeg -y \
|
ffmpeg -y \
|
||||||
@ -22,7 +23,7 @@ add_audio () {
|
|||||||
$3
|
$3
|
||||||
}
|
}
|
||||||
|
|
||||||
add_audio "$IN" "$AUDIOS/instrument_1.mp3" "$OUT/soprane.mkv"
|
add_audio "$IN" "$AUDIOS/${BASE_NAME}1.mp3" "$OUT/soprane.mkv"
|
||||||
add_audio "$IN" "$AUDIOS/instrument_2.mp3" "$OUT/alti.mkv"
|
add_audio "$IN" "$AUDIOS/${BASE_NAME}2.mp3" "$OUT/alti.mkv"
|
||||||
add_audio "$IN" "$AUDIOS/instrument_3.mp3" "$OUT/tenor.mkv"
|
add_audio "$IN" "$AUDIOS/${BASE_NAME}3.mp3" "$OUT/tenor.mkv"
|
||||||
add_audio "$IN" "$AUDIOS/instrument_4.mp3" "$OUT/basse.mkv"
|
add_audio "$IN" "$AUDIOS/${BASE_NAME}4.mp3" "$OUT/basse.mkv"
|
||||||
|
29
src/superpose_audios.sh
Executable file
29
src/superpose_audios.sh
Executable file
@ -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)"
|
Loading…
Reference in New Issue
Block a user