Javicle - a JSON Video Composition Language
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

50 linhas
1.3 KiB

  1. #!/bin/bash
  2. #
  3. # Split a media file into multiple files of equal time length
  4. #
  5. # Usage:
  6. #
  7. # jsplit in-file out-dir interval [start] [end]
  8. #
  9. # in-file : file to trim
  10. # out-dir : write split files to this directory (will be created if it does not exist)
  11. # interval : time duration of output files, in seconds
  12. # start : when to start splitting the in-file. default is 0 (start)
  13. # end : when to stop splitting the in-file. default is to continue until end of file is reached
  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_DIR="${2?no out-dir provided}"
  20. if [[ -e "${OUT_DIR}" && ! -d "${OUT_DIR}" ]] ; then
  21. die "Not a directory: ${OUT_DIR}"
  22. fi
  23. mkdir -p "${OUT_DIR}" || die "Error creating ${OUT_DIR}"
  24. INTERVAL="${3?no interval provided}"
  25. T_START="${4}"
  26. T_END="${5}"
  27. echo "
  28. {
  29. \"assets\": [
  30. { \"name\": \"input\", \"path\": \"${IN_FILE}\" }
  31. ],
  32. \"operations\": [
  33. {
  34. \"operation\": \"split\",
  35. \"creates\": {
  36. \"name\": \"splits\",
  37. \"dest\": \"${OUT_DIR}/\"
  38. },
  39. \"source\": \"input\",
  40. \"interval\": \"${INTERVAL}\"$(if [[ -n "${T_START}" ]] ; then echo ",
  41. \"start\": \"${T_START}\"" ; fi)$(if [[ -n "${T_END}" ]] ; then echo ",
  42. \"end\": \"${T_END}\"," ; fi)
  43. }
  44. ]
  45. }
  46. " | "${SCRIPT_DIR}"/jvc ${JVC_OPTIONS}