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.

concepts.md 2.8 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Concepts
  2. In JVC the main concepts are assets and operations.
  3. The [complex example](complex_example.md)
  4. illustrates just about every way to represent input assets,
  5. output assets, operation configs.
  6. If you find yourself getting confused with some of what follows,
  7. maybe browse through that [example](complex_example.md) first.
  8. ## Assets
  9. Assets are your media files: generally image, audio and video files.
  10. All assets have a name and a path.
  11. Input assets are defined using the `assets` array of a JVC spec.
  12. For input assets, the path can be a file or a URL. URL-based assets will be downloaded
  13. to the scratch directory. This can be overridden using the `dest` property on the asset.
  14. Operations produce one or more output assets, as specified in the `creates` property of
  15. an operation JSON object.
  16. For output assets, the path will be within the scratch directory.
  17. You can override this using the `dest` property on the `creates` object associated with the operation.
  18. ### Asset Properties
  19. Assets expose properties that can be referenced in operations. The properties currently exposed are:
  20. * `duration`: duration of the audio/video in seconds (audio and video assets only)
  21. * `width`: width of the video in pixels (video and image assets only)
  22. * `height`: width of the video in pixels (video and image assets only)
  23. * `aspectRatio`: ratio of width / height (video and image assets only)
  24. * `samplingRate`: sampling rate in Hz (audio assets only)
  25. * `tracks`: array of tracks. only includes audio and video tracks (video assets only)
  26. * `audioTracks`: array of audio tracks (video assets only)
  27. * `videoTracks`: array of video tracks (video assets only)
  28. * `assets`: for a list asset, these are the nested sub-assets
  29. ## Operations
  30. Operations represent transformations to perform on the inputs, and validations
  31. to ensure correctness.
  32. ### Operation Assets
  33. An operation requires one or more input assets. These assets are referenced
  34. using the `source` (or for `concat`, `sources`) parameter.
  35. An operation can produce one or more new assets, which can then be referenced in
  36. later operations.
  37. Learn more about [Asset References](asset_refs.md).
  38. ### Operation Configuration
  39. Many of the operation settings can be JavaScript expressions, for example:
  40. "start": "someAsset.duration - 10"
  41. The above would set the `start` value to ten seconds before the end of `someAsset`.
  42. Learn more about [JavaScript expressions in JVC](jvc_js.md).
  43. ### Operation Validation
  44. An operation may define validations to perform by defining a `validation` array.
  45. Each object in the array has properties `comment` (to describe the test) and
  46. `test` which is a JavaScript expression. If it evaluates to `true` then the
  47. test passes. If `false`, the test fails and the `comment` is printed.
  48. Learn more about [JavaScript expressions in JVC](jvc_js.md).