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.

README.md 5.5 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # Javicle - a JSON Video Composition Language
  2. Javicle (JVC for short) is a JSON DSL for audio/video transformations.
  3. Under the hood, it's all shell commands: `ffmpeg`, `mediainfo` and so on.
  4. JVC provides higher-level semantics for working with these lower level tools.
  5. # Motivation
  6. I infrequently find myself doing video editing, so I've never bothered to
  7. learn iMovie or any graphical video editor.
  8. My editing needs are usually pretty simple, so I bust out ffmpeg and get the
  9. job done.
  10. But it seems like every time, there is at least one wrinkle in the requirements
  11. that requires some deep research into
  12. [ffmpeg filter arcana](https://ffmpeg.org/ffmpeg-filters.html).
  13. Hours later, before I know it, the day has gone by.
  14. I created JVC to make it really easy to do the most common things people
  15. usually do to videos: splitting, concatenating, letterboxing, overlaying
  16. one video onto another, and so on.
  17. # A Quick Example
  18. Suppose you have one video that is five minutes long,
  19. and you want to split it into five videos, each one minute long.
  20. With ffmpeg and bash, you might do something like this:
  21. ```shell script
  22. INCR=60
  23. for ((i=0;i<300;i=(i+INCR))); do
  24. ffmpeg -i /tmp/my/source.mp4 -ss ${i} -t $((i+INCR)) /tmp/my/slice_${i}_$((i+INCR)).mp4
  25. done
  26. ```
  27. With JVC, you'd write this spec file and save it to a file
  28. (for example `my-spec.jvc`):
  29. ```json
  30. {
  31. "assets": [ {"name": "src", "path": "/tmp/my/source.mp4"} ],
  32. "operations": [{
  33. "operation": "split",
  34. "creates": "src_split_files",
  35. "source": "src",
  36. "interval": "60",
  37. "validate": [{
  38. "comment": "expect 5 output files",
  39. "test": "output.assets.length === 5"
  40. }]
  41. }]
  42. }
  43. ```
  44. and then run it like this:
  45. ```shell script
  46. jvc my-spec.jvc
  47. ```
  48. Yes, the JVC is longer, but I think many would agree it is easier to read
  49. and maintain. It can also include validations (as shown above) to ensure
  50. the output assets are what you expect them to be.
  51. **As the number of media assets and operations grows, hand-crafted shell
  52. scripts with magical ffmpeg incantations become ever more inscrutable.**
  53. JVC is designed for readability and maintainability. JVC will continue to
  54. evolve towards greater coverage of the full capabilities of ffmpeg.
  55. # Who is JVC not for?
  56. If you like GUIs, JVC is probably not for you.
  57. JVC is not a replacement for Final Cut Pro or even iMovie.
  58. # Who is JVC for?
  59. JVC is for people who like CLIs and automation.
  60. JVC is for people with relatively simple video composition needs (for now),
  61. since the range of operations supported is limited.
  62. JVC is for people who have used ffmpeg filters before and had flashbacks
  63. of editing Sendmail configs, debugging PostScript, or maintaining a legacy
  64. Perl system.
  65. ##### Caveat Emptor
  66. Obligatory Disclaimer: JVC is still relatively new software and lots of stuff
  67. might not work right, ffmpeg could crap out on bad arguments, encodings,
  68. formats, filter syntax errors, or whatever.
  69. In any case, JVC should never overwrite your source files, since all output
  70. goes to new files.
  71. # Requirements
  72. * Java 11
  73. * Maven 3
  74. * ffmpeg
  75. * mediainfo
  76. These programs should executable (given your `PATH`): `javac`, `java`, `mvn`,
  77. `ffmpeg`, and `mediainfo`
  78. The first time you run `jvc`, it will automatically build the JVC jar file
  79. from sources, using maven and javac. This takes a little time but only needs
  80. to be done once.
  81. # Running JVC
  82. Learn more about **[running `jvc`](docs/running.md)** and other useful tools.
  83. # JVC Concepts
  84. Learn about **[Assets and Operations](docs/concepts.md)**, the core concepts
  85. of JVC.
  86. # Supported Operations
  87. Today, JVC supports several basic operations.
  88. For each operation listed below, the header links to an example from the JVC
  89. test suite.
  90. ### [add-silence](src/test/resources/tests/test_add_silence.jvc)
  91. Add a silent audio track to a video asset.
  92. ### [adjust-speed](src/test/resources/tests/test_adjust_speed.jvc)
  93. Speed up or slow down a video asset. Sound can be silenced, played at
  94. regular speed, or sped up/slowed down to match the video.
  95. ### [concat](src/test/resources/tests/test_concat.jvc)
  96. Concatenate audio/video assets together into one asset.
  97. ### [ken-burns](src/test/resources/tests/test_ken_burns.jvc)
  98. Transform a still image into video via a zoom-pan (aka Ken Burns) effect.
  99. ### [letterbox](src/test/resources/tests/test_letterbox.jvc)
  100. Resize a video, maintaining the aspect ratio and adding letterboxes on
  101. the sides or top/bottom.
  102. ### [merge-audio](src/test/resources/tests/test_merge_audio.jvc)
  103. Merge an audio asset into the audio track of a video asset.
  104. ### [overlay](src/test/resources/tests/test_overlay.jvc)
  105. Overlay one video onto another.
  106. ### [remove-track](src/test/resources/tests/test_remove_track.jvc)
  107. Remove a track from a video asset.
  108. ### [scale](src/test/resources/tests/test_scale.jvc)
  109. Scale a video asset from one size to another. Scaling can be proportional
  110. or anamorphic.
  111. ### [split](src/test/resources/tests/test_split.jvc)
  112. Split an audio/video asset into multiple assets of equal time lengths.
  113. ### [trim](src/test/resources/tests/test_trim.jvc)
  114. Trim audio/video; crop a section of an asset, becomes a new asset.
  115. ## Complex Example
  116. Here is a [long, complex example](docs/complex_example.md) that uses
  117. every operation.
  118. ## JavaScript Expressions
  119. Within a JVC spec file, operation parameters and validations can
  120. be [JavaScript expressions](docs/jvc_js.md), opening up some interesting
  121. capabilities.
  122. ## What's with the name?
  123. A cross between a javelin and an icicle? JSON and a miracle?
  124. Something with positive connotations?
  125. I really don't like naming things.