From 736c7a9f09af460b51d1f5c3d885f9176189b5c6 Mon Sep 17 00:00:00 2001 From: "Gary E. Deschaines" Date: Mon, 18 Dec 2023 08:43:35 -0600 Subject: [PATCH] Added same NOTE as in Batch files --- util/png2gif.sh | 11 +++++++++-- util/png2mp4.sh | 21 +++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/util/png2gif.sh b/util/png2gif.sh index 7cfa9fb..afc9721 100644 --- a/util/png2gif.sh +++ b/util/png2gif.sh @@ -5,8 +5,15 @@ #AUTH: G. E. Deschaines #DESC: Converts a sequence of PNG files to GIF files and merges # the GIF files into an animated GIF file. - -#NOTE: Requires the ImageMagick convert program. +# +# NOTE: +# +# [1] Requires ImageMagick magick program. +# +# [2] Invoke this shell script while working within the pyThreeD +# subdirectory containing img_####.png files (i.e., ./Ximg) +# as ../util/png2gif.sh since it's assumed relative path +# ../pyThreeD.py exists from where this shell script executes. # Get list of PNG files. diff --git a/util/png2mp4.sh b/util/png2mp4.sh index 2cf6593..346f32c 100644 --- a/util/png2mp4.sh +++ b/util/png2mp4.sh @@ -5,8 +5,17 @@ #AUTH: G. E. Deschaines #DESC: Converts a sequence of PNG files to JPEG files and merges # the JPEG files into a MP4 video file. - -#NOTE: Requires ffmpeg and the ImageMagick convert program. +# +# NOTE: +# +# [1] Requires ffmpeg and the ImageMagick magick program. +# +# [2] Invoke this shell script while working within the pyThreeD +# subdirectory containing img_####.png files (i.e., ./Ximg) +# as ../util/png2mp4.sh since it's assumed relative path +# ../pyThreeD.py exists from where this shell script executes. + +FFMPEG_EXE=/usr/bin/ffmpeg # Get list of PNG files. @@ -34,17 +43,17 @@ FPS=`grep "img_FPS = " ../pyThreeD.py | gawk '{ print gensub(";","",1,$3) }'` SYSNAM=`uname -a` -if [ "${SYSNAM%% *}" == "Linux" ] && [ -e /usr/bin/ffmpeg ] +if [ "${SYSNAM%% *}" == "Linux" ] && [ -e ${FFMPEG_EXE} ] then echo "Creating MP4 video: img_anim.mp4 @ 25 fps" - /usr/bin/ffmpeg -loglevel error -f image2 -framerate ${FPS} -i ./img_%04d.jpg -r 25 -vcodec libx264 -b:v 8000k -crf 18 -pix_fmt yuv420p ./img_anim.mp4 + ${FFMPEG_EXE} -loglevel error -f image2 -framerate ${FPS} -i ./img_%04d.jpg -r 25 -vcodec libx264 -b:v 8000k -crf 18 -pix_fmt yuv420p ./img_anim.mp4 exit 0 fi -if [ "${SYSNAM%%_*}" == "CYGWIN" ] && [ -e /usr/bin/ffmpeg ] +if [ "${SYSNAM%%_*}" == "CYGWIN" ] && [ -e ${FFMPEG_EXE} ] then echo "Creating MP4 video: img_anim.mp4 @ 25 fps" - /usr/bin/ffmpeg -loglevel error -f image2 -framerate ${FPS} -i ./img_%04d.jpg -r 25 -vcodec mpeg4 -b:v 8000k -crf 18 -pix_fmt yuv420p ./img_anim.mp4 + ${FFMPEG_EXE} -loglevel error -f image2 -framerate ${FPS} -i ./img_%04d.jpg -r 25 -vcodec mpeg4 -b:v 8000k -crf 18 -pix_fmt yuv420p ./img_anim.mp4 exit 0 fi