Basándome en las idea de Harry Durgin, he creado un script que genera un vídeo a partir de una imagen panorámica, tanto horizontal como vertical. Para muestra un botón, esta sería la imagen:

Y este el vídeo resultante:

Uno de los detalles es que paa que este script funcione tenemos que tener isntalado libav-tools dado que usamos avconv para montar el vídeo.

 

El código es el siguiente (lo se, se puede mejorar, pero escribir código no es mi especialidad, si alguien lo optimiza que avise):

#!/bin/bash
# Create a video from a pano
# In order to get avconv you need to install libav-tools

declare -i width
declare -i height
declare -i loop

#Get the size of the image
width=$(exiftool -s -s -s -ImageWidth $1);
height=$(exiftool -s -s -s -ImageHeight $1);

#Set image orientation
if [ “$width” -gt “$height” ]; then
image=”horizontal”;
else
image=”vertical”;
fi

#Check if the image is big enough
if [ “$image” == “horizontal” ]; then
if [ $height -lt 720 ]; then
echo “Error: The image is too small for a HD video”;
exit 1
fi
else
if [ $width -lt 1280 ]; then
echo “Error: The image is too small for a HD video”;
exit 1
fi
fi

mkdir frames;

#Set the correct size and get the slices
if [ “$image” == “horizontal” ]; then
if [ “$height” -ge 1080 ]; then
convert $1 -resize x1080 tempic.jpg;
width=$(exiftool -s -s -s -ImageWidth tempic.jpg);
loop=($width-1920);
numb=$(( $(echo $loop| wc -c ) – 1 ));
seq -w 0 $loop |while read c; do convert tempic.jpg -crop 1920×1080+$c+0 frames/$c.jpg;
done
else
convert $1 -resize x720 tempic.jpg;
width=$(exiftool -s -s -s -ImageWidth tempic.jpg);
loop=($width-1280);
numb=$(( $(echo $loop| wc -c ) – 1 ));
seq -w 0 $loop |while read c; do convert tempic.jpg -crop 1280×720+$c+0 frames/$c.jpg;
done
fi
else
if [ “$width” -ge 1920 ]; then
convert $1 -resize 1920 tempic.jpg;
height=$(exiftool -s -s -s -ImageHeight tempic.jpg);
loop=($height-1080);
numb=$(( $(echo $loop| wc -c ) – 1 ));
seq -w 0 $loop |while read c; do convert tempic.jpg -crop 1920×1080+0+$c frames/$c.jpg;
done
else
convert $1 -resize 1280 tempic.jpg;
height=$(exiftool -s -s -s -ImageHeight tempic.jpg);
loop=($height-720);
numb=$(( $(echo $loop| wc -c ) – 1 ));
seq -w 0 $loop |while read c; do convert tempic.jpg -crop 1280×720+0+$c frames/$c.jpg;
done
fi
fi

#Join the frames in a video
avconv -f image2 -r 60 -i frames/%0${numb}d.jpg -b:v 15000k video.avi;

rm tempic.jpg;
rm frames/*.jpg;
rmdir frames;

https://www.apratizando.com/wp-content/plugins/dn_iSocial/images/facebook_48.png https://www.apratizando.com/wp-content/plugins/dn_iSocial/images/linkedin_48.png https://www.apratizando.com/wp-content/plugins/dn_iSocial/images/twitter_48.png https://www.apratizando.com/wp-content/plugins/dn_iSocial/images/meneame_48.png https://www.apratizando.com/wp-content/plugins/dn_iSocial/images/barrapunto_48.png