2022-12-03 12:25:37 +11:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ $# -ne 2 ] ; then
|
|
|
|
echo
|
|
|
|
echo "need two arguments:"
|
|
|
|
echo " 1) source dir"
|
|
|
|
echo " 2) mp4 filename"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
SDIR="$1"
|
|
|
|
FNAME="$2"
|
|
|
|
echo "Encoding from " $SDIR " to " $FNAME
|
|
|
|
|
2022-12-04 06:42:29 +11:00
|
|
|
#
|
|
|
|
# trying to guess the format of inoput files
|
|
|
|
#
|
|
|
|
firstfile=$(ls -1 $SDIR/* | head -1)
|
|
|
|
echo "first file :" $firstfile
|
|
|
|
filetype=$(file $firstfile | awk '{ print $2 }')
|
|
|
|
echo "file type :" $filetype
|
|
|
|
|
|
|
|
case $filetype in
|
|
|
|
PNG) extension=".png" ;;
|
|
|
|
Netpbm) extension=".pgm" ;;
|
|
|
|
*) extension=".binary" ;;
|
|
|
|
esac
|
|
|
|
echo "extension :" $extension
|
|
|
|
|
2022-12-03 12:25:37 +11:00
|
|
|
TITLE='---{ experimental gravity field }---'
|
|
|
|
|
|
|
|
ffmpeg -nostdin \
|
|
|
|
-loglevel warning \
|
2022-12-04 06:42:29 +11:00
|
|
|
-y -r 30 -f image2 -i ${SDIR}/%05d${extension} \
|
2022-12-03 12:25:37 +11:00
|
|
|
-metadata artist='---{ tTh }---' \
|
|
|
|
-metadata title="${TITLE}" \
|
|
|
|
-c:v libx264 -pix_fmt yuv420p \
|
|
|
|
$FNAME
|
|
|
|
|
2022-12-04 06:42:29 +11:00
|
|
|
echo
|
|
|
|
|
2022-12-03 12:25:37 +11:00
|
|
|
|