Skip to content

Commit

Permalink
feat(Watermark): add watermark to gifs
Browse files Browse the repository at this point in the history
  • Loading branch information
fjcaetano committed Nov 5, 2019
1 parent 9e7a3fd commit 4d3324b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ $ ios-simulator-gif [options] {out_file} {-- [ffmpeg options]}
| -r, --rate | Framerate of the output | `6` |
| -f, --format | Output format | `gif` |
| -vf, --video-filter | Video filter for `ffmpeg` | `scale=320:-1` |
| --no-watermark | Remove watermark from gif | N/A |
| -h, --help | Prints helper message | N/A |
| -v, --version | Prints current version | N/A |

Expand Down
8 changes: 7 additions & 1 deletion bin/ios-simulator-gif
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ record() {
#######################
convert_gif() {
echo -e "Converting and saving to ${FILE_NAME}\n"
ffmpeg -i /tmp/simulator.mov -vf $VIDEOFILTER -r $RATE -f $FORMAT -y $FILE_NAME $EXTRA &> /tmp/ffmpeg.log
WATERMARK_CMD="drawtext=text='ios-simulator-gif':x=10:y=H-th-10:fontsize=40:fontcolor=white:shadowcolor=black:shadowx=5:shadowy=5"
ffmpeg -i /tmp/simulator.mov -vf "${HIDE_WATERMARK-$WATERMARK_CMD,}${VIDEOFILTER}" -r $RATE -f $FORMAT -y $FILE_NAME $EXTRA &> /tmp/ffmpeg.log

if [[ $? -eq 0 ]]; then
echo -e "${GREEN}Gif saved to ${FILE_NAME}${CLEAR}"
Expand Down Expand Up @@ -120,6 +121,10 @@ parse_args() {
echo "${PKG_VERSION}"
exit 0
;;
--no-watermark)
HIDE_WATERMARK=''
shift 1
;;
--)
EXTRA="${@:2}"
shift
Expand Down Expand Up @@ -152,6 +157,7 @@ display_help() {
echo " -r, --rate Framerate of the output (default: 6)"
echo " -f, --format Output format (default: gif)"
echo " -vf, --video-filter Video filter for ffmpeg (default: scale=320:-1)"
echo " --no-watermark Remove watermark from gif"
echo " -h, --help Outputs this help message"
echo " -v, --version Outputs the version number"
echo
Expand Down

0 comments on commit 4d3324b

Please sign in to comment.