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.

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