chatchai_j

watermark.sh

Jun 27th, 2022 (edited)
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.96 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # SRCDIR = "F:\\2022-06-21" -- Windows Folder
  4. # DSTDIR = "E:\\2022-06-21" -- Windows Folder
  5.  
  6. SRCDIR="${HOME}/F/2022-06-21"
  7. DSTDIR="${HOME}/E/2022-06-21"
  8.  
  9. FFMPEG="/usr/bin/ffmpeg"
  10.  
  11. ## Note: Not sure about the '\,' in these string, you might have to change from '\,' to '\\,' or maybe just ','
  12. ## to get the correct "qoute"
  13.  
  14. FILTERGRAPH="drawtext=text='Uploaded to XYZ.net':fontfile=arial-bold.ttf:y=line_h-10:x=w-mod(max(t\,0)*(w+tw)/30\,(w+tw)):fontcolor=ffffff:fontsize=20:shadowx=2:shadowy=2:enable=lt(mod(t\,300)\,30)"
  15.  
  16. [ ! -x "${FFMPEG}" ] && echo "Can't find ${FFMPEG}" && exit
  17.  
  18. # if destination directory is not exist, then create it.
  19. [ ! -d "${DSTDIR}" ] && mkdir -p ${DSTDIR}
  20. [ ! -d "${DSTDIR}" ] && echo "Failed to create directory '${DSTDIR}'" && exit
  21.  
  22. for MP4 in ${SRCDIR}/*.mp4; do
  23.     DST=$(basename $MP4)
  24.     echo "Watermarking from '$MP4' to '${DSTDIR}/$DST'"
  25.     ${FFMPEG} -i "$MP4" -vf "${FILTERGRAPH}" -c:a copy ${DSTDIR}/${DST}
  26. done
  27.  
Add Comment
Please, Sign In to add comment