#!/bin/bash #programma per mosaico video #https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos #+come sempre % = spazio # Bold BBlack='\e[1;30m' # Nero BRed='\e[1;31m' # Rosso BGreen='\e[1;32m' # Verde BYellow='\e[1;33m' # Giallo BBlue='\e[1;34m' # Blu BPurple='\e[1;35m' # Viola BCyan='\e[1;36m' # Ciano BWhite='\e[1;37m' # Bianco Color_Off='\e[0m' # Text Reset reset_console="\E[37;40m" #biancoBold echo -e $BRed'PROGRAMMA shell PER mosaico 4 VIDEO' echo -e $BWhite'Immetti titolo primo video in alto a sinistra' read fhl echo -e $BYellow$fhl echo -e $BWhite'Immetti titolo secondo video in alto a destra' read shr echo -e $BYellow$shr echo -e $BWhite'Immetti titolo terzo video in basso a sinistra' read tll echo -e $BYellow$tll echo -e $BWhite'Immetti titolo ultimo video in basso a destra' read llr echo -e $BYellow$llr echo -e $BRed'Immetti titolo da assegnare al video mosaico' read out echo -e $BYellow$out echo -e $BRed'TUTTO CORRETTO? (y /N)' read ok if [[ "$ok" == "n" || "$ok" == "N" ]] then echo -e $BRed'PROGRAMMA INTERROTTO!' exit 0 else echo -e $BWhite'Elaborazione del video mosaico...' ffmpeg \ -i $fhl \ -i $shr \ -i $tll \ -i $llr \ -filter_complex " nullsrc=size=1280x720 [base]; [0:v] setpts=PTS-STARTPTS, scale=600x300 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=600x300 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=600x300 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=600x300 [lowerright]; [base][upperleft] overlay=shortest=1:x=20 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=640 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=360 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=640:y=360" -c:v libx264 -t '10' $out echo -e $BWhite'Il tuo video mosaico รจ '$BYellow$out fi #APPUNTI DOPO PROVE: il primo video, quello in alto a sinistra fornisce #+ l'audio e sembra fornire la base della lunghezza invece che l'opzione #+shortest exit 0