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.

jspeed 1.1 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. #
  3. # Adjust the speed of a video, optionally adjusting the audio as well.
  4. #
  5. # Usage:
  6. #
  7. # jspeed in-file out-file speed-factor [audio-speed]
  8. #
  9. # in-file : input video file
  10. # out-file : write output file here
  11. # speed-factor : factor=1 is unchanged, factor>1 is faster, factor<1 is slower
  12. # audio-speed : can be: silent (default), unchanged, or match
  13. #
  14. # Note: if audio-speed is match, then speed-factor must be between 0.5 and 100
  15. #
  16. SCRIPT="${0}"
  17. SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
  18. . "${SCRIPT_DIR}"/jvc_common
  19. IN_FILE="${1?no video-file provided}"
  20. OUT_FILE="${2?no out-file provided}"
  21. SPEED_FACTOR="${3?no speed-factor provided}"
  22. AUDIO_SPEED="${4}"
  23. echo "
  24. {
  25. \"assets\": [
  26. { \"name\": \"input\", \"path\": \"${IN_FILE}\" }
  27. ],
  28. \"operations\": [
  29. {
  30. \"operation\": \"adjust-speed\",
  31. \"creates\": {
  32. \"name\": \"speed_adjusted\",
  33. \"dest\": \"${OUT_FILE}\"
  34. },
  35. \"source\": \"input\",
  36. \"factor\": \"${SPEED_FACTOR}\"$(if [[ -n "${AUDIO_SPEED}" ]] ; then echo ",
  37. \"audio\": \"${AUDIO_SPEED}\"" ; fi)
  38. }
  39. ]
  40. }
  41. " | "${SCRIPT_DIR}"/jvc ${JVC_OPTIONS}