Javicle - a JSON Video Composition Language
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 rivejä
2.1 KiB

  1. #!/bin/bash
  2. #
  3. # Apply zoom-pan effect to a still image to create a video
  4. #
  5. # Usage:
  6. #
  7. # jkenburns [-n|--no-exec] in-file out-file duration [zoom] [x] [y] [start] [end] [fps] [width] [height]
  8. #
  9. # -n or --no-exec : if set, do not execute ffmpeg but print what would have run
  10. # in-file : file to trim
  11. # out-file : write scaled file here
  12. # duration : how long the output video will be
  13. # zoom : zoom factor, default is 1 (no zoom)
  14. # x : zoom focus X point, default is center
  15. # y : zoom focus Y point, default is center
  16. # start : when to start zooming, default is beginning of video
  17. # end : when to end zooming, default is end of video
  18. # fps : frame per second for output video, default is 25
  19. # width : output width, default is in-file width
  20. # height : output height, default is in-file height
  21. #
  22. SCRIPT="${0}"
  23. SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
  24. . "${SCRIPT_DIR}"/jvc_common
  25. IN_FILE="${1?no in-file provided}"
  26. OUT_FILE="${2?no out-file provided}"
  27. DURATION="${3:?no duration provided}"
  28. ZOOM="${4}"
  29. X_POS="${5}"
  30. Y_POS="${6}"
  31. T_START="${7}"
  32. T_END="${8}"
  33. FRAMES_PER_SEC="${9}"
  34. WIDTH="${10}"
  35. HEIGHT="${11}"
  36. echo "
  37. {
  38. \"assets\": [
  39. { \"name\": \"input\", \"path\": \"${IN_FILE}\" }
  40. ],
  41. \"operations\": [
  42. {
  43. \"operation\": \"ken-burns\",
  44. \"creates\": {
  45. \"name\": \"zoompan\",
  46. \"dest\": \"${OUT_FILE}\"
  47. },
  48. \"source\": \"input\",
  49. \"duration\": \"${DURATION}\"$(if [[ -n "${ZOOM}" ]] ; then echo ",
  50. \"zoom\": \"${ZOOM}\""; fi)$(if [[ -n "${X_POS}" ]] ; then echo ",
  51. \"x\": \"${X_POS}\""; fi)$(if [[ -n "${Y_POS}" ]] ; then echo ",
  52. \"y\": \"${Y_POS}\""; fi)$(if [[ -n "${T_START}" ]] ; then echo ",
  53. \"start\": \"${T_START}\""; fi)$(if [[ -n "${T_END}" ]] ; then echo ",
  54. \"end\": \"${T_END}\""; fi)$(if [[ -n "${FRAMES_PER_SEC}" ]] ; then echo ",
  55. \"fps\": \"${FRAMES_PER_SEC}\""; fi)$(if [[ -n "${WIDTH}" ]] ; then echo ",
  56. \"width\": \"${WIDTH}\""; fi)$(if [[ -n "${HEIGHT}" ]] ; then echo ",
  57. \"height\": \"${HEIGHT}\""; fi)
  58. }
  59. ]
  60. }
  61. " | "${SCRIPT_DIR}"/jvc ${JVC_OPTIONS}