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.

48 lines
1.1 KiB

  1. #!/bin/bash
  2. #!/bin/bash
  3. #
  4. # Letterbox a video file
  5. #
  6. # Usage:
  7. #
  8. # jletterbox [-n|--no-exec] in-file out-file width height [color]
  9. #
  10. # -n or --no-exec : if set, do not execute ffmpeg but print what would have run
  11. # in-file : file to trim
  12. # out-file : write scaled file here
  13. # width : output width
  14. # height : output height
  15. # color : padding color, can be a hex value (0xff0000 is red), or a
  16. # color name from https://ffmpeg.org/ffmpeg-utils.html#color-syntax
  17. #
  18. SCRIPT="${0}"
  19. SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
  20. . "${SCRIPT_DIR}"/jvc_common
  21. IN_FILE="${1?no in-file provided}"
  22. OUT_FILE="${2?no out-file provided}"
  23. WIDTH="${3}"
  24. HEIGHT="${4}"
  25. COLOR="${5:-black}"
  26. echo "
  27. {
  28. \"assets\": [
  29. { \"name\": \"input\", \"path\": \"${IN_FILE}\" }
  30. ],
  31. \"operations\": [
  32. {
  33. \"operation\": \"letterbox\",
  34. \"creates\": {
  35. \"name\": \"boxed\",
  36. \"dest\": \"${OUT_FILE}\"
  37. },
  38. \"source\": \"input\",
  39. \"width\": \"${WIDTH}\",
  40. \"height\": \"${HEIGHT}\",
  41. \"color\": \"${COLOR}\"
  42. }
  43. ]
  44. }
  45. " | "${SCRIPT_DIR}"/jvc ${JVC_OPTIONS}