2022-03-30 17:42:39 +11:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-04-04 20:34:50 +11:00
|
|
|
if [ $# -ne 2 ] ; then
|
|
|
|
echo
|
|
|
|
echo "need two arguments:"
|
|
|
|
echo " source dir"
|
|
|
|
echo " mp4 filename"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-03-30 17:42:39 +11:00
|
|
|
|
2022-04-04 20:34:50 +11:00
|
|
|
SDIR="$1"
|
|
|
|
FNAME="$2"
|
|
|
|
echo "Encoding from " $SDIR " to " $FNAME
|
|
|
|
|
2023-01-03 11:22:40 +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
|
|
|
|
|
|
|
|
#
|
|
|
|
# this is BOGUS, replace file by identify ?
|
|
|
|
#
|
|
|
|
case $filetype in
|
|
|
|
PNG) extension=".png" ;;
|
|
|
|
Netpbm) extension=".pgm" ;;
|
|
|
|
*) extension=".binary" ;;
|
|
|
|
esac
|
|
|
|
echo "extension :" $extension
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-04 20:34:50 +11:00
|
|
|
TITLE='---{ experimental }---'
|
2022-03-30 17:42:39 +11:00
|
|
|
|
|
|
|
ffmpeg -nostdin \
|
2022-04-04 20:34:50 +11:00
|
|
|
-loglevel warning \
|
2023-01-03 11:22:40 +11:00
|
|
|
-y -r 30 -f image2 -i $SDIR/%05d.pnm \
|
2022-04-04 20:34:50 +11:00
|
|
|
-metadata artist='---{ tTh }---' \
|
|
|
|
-metadata title="${TITLE}" \
|
2023-01-03 11:22:40 +11:00
|
|
|
-preset veryslow \
|
2022-04-04 20:34:50 +11:00
|
|
|
-c:v libx264 -pix_fmt yuv420p \
|
|
|
|
$FNAME
|
2022-03-30 17:42:39 +11:00
|
|
|
|
|
|
|
|