Skip to content

Commit

Permalink
Added same NOTE as in Batch files
Browse files Browse the repository at this point in the history
  • Loading branch information
gedeschaines committed Dec 18, 2023
1 parent 96f38b5 commit 736c7a9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
11 changes: 9 additions & 2 deletions util/png2gif.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
21 changes: 15 additions & 6 deletions util/png2mp4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 736c7a9

Please sign in to comment.