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.

43 lines
1.0 KiB

  1. #!/bin/bash
  2. #
  3. # Trim a media file
  4. #
  5. # Usage:
  6. #
  7. # jtrim [-n|--no-exec] in-file out-file [start] [end]
  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 trimmed file here
  12. # start : seconds to trim from the beginning. if omitted, default value is start of the file
  13. # end : retain the file until this number of seconds. if omitted, default is to end of file
  14. #
  15. SCRIPT="${0}"
  16. SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
  17. . "${SCRIPT_DIR}"/jvc_common
  18. IN_FILE="${1?no in-file provided}"
  19. OUT_FILE="${2?no out-file provided}"
  20. T_START="${3}"
  21. T_END="${4}"
  22. echo "
  23. {
  24. \"assets\": [
  25. { \"name\": \"input\", \"path\": \"${IN_FILE}\" }
  26. ],
  27. \"operations\": [
  28. {
  29. \"operation\": \"trim\",
  30. \"creates\": {
  31. \"name\": \"trimmed\",
  32. \"dest\": \"${OUT_FILE}\"
  33. },
  34. \"source\": \"input\",
  35. \"start\": \"${T_START}\",
  36. \"end\": \"${T_END}\"
  37. }
  38. ]
  39. }
  40. " | "${SCRIPT_DIR}"/jvc ${JVC_OPTIONS}