Javicle - a JSON Video Composition Language
Você não pode selecionar mais de 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.

README.md 5.2 KiB

4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
4 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # Javicle - a JSON Video Composition Language
  2. Javicle is a JSON DSL for audio/video transformations.
  3. Under the hood, it's all shell commands: ffmpeg, mediainfo, sox, and so on.
  4. JVCL provides higher-level semantics for working with these lower level tools.
  5. # A Quick Example
  6. Say you want to split a portion of a video into ten-second chunks. With ffmpeg
  7. and bash, you might do something like this:
  8. ```shell script
  9. START=10
  10. END=130
  11. INCR=10
  12. for ((i=START;i<END;i=(i+INCR))); do
  13. ffmpeg -i $i /tmp/my/source.mp4 -ss $((i)) -t $((i+INCR)) /tmp/my/slice_$((i))_$((i+INCR)).mp4
  14. done
  15. ```
  16. With JVCL, you would use write this spec:
  17. ```json
  18. {
  19. "assets": [ {"name": "src", "path": "/tmp/my/source.mp4"} ],
  20. "operations": [{
  21. "operation": "split",
  22. "creates": "src_splits",
  23. "perform": {
  24. "split": "src",
  25. "interval": "10s",
  26. "start": "10s",
  27. "end": "130s"
  28. }
  29. }]
  30. }
  31. ```
  32. And then run `jvcl spec-file.json` on your spec, and it would run essentially the same ffmepg commands.
  33. # Who is this not for?
  34. If you like GUIs, Javicle is probably not for you.
  35. Javicle is not a replacement for Final Cut Pro or even iMovie.
  36. # Who is this for?
  37. If you like CLIs, Javicle might be for you.
  38. You might enjoy Javicle if your video composition needs are relatively simple and/or
  39. you enjoy capturing repeatable processes in source control.
  40. # Concepts
  41. In JVCL there are two main concepts: assets and operations.
  42. ## Assets
  43. Assets are the inputs - generally image, audio and video files. Assets have a name and a path.
  44. The path can be a file or a URL.
  45. ## Operations
  46. Operations are transformations to perform on the inputs.
  47. An operation can produce a new intermediate asset.
  48. Intermediate assets have names, and special paths that indicate how to reconstruct them from their assets, such that if you have the path of an intermediate asset, you can recreate its content, assuming you supply the same input assets.
  49. The operations that JVCL either supports or intends to support are:
  50. ### split
  51. Split an audio/video asset into multiple assets
  52. ### concat
  53. Concatenate audio/video assets together into one asset
  54. ### trim
  55. Trim audio/video - crop from beginning, end, or both
  56. ### overlay
  57. Overlay one video file onto another
  58. ### ken-burns
  59. For transforming still images into video via a fade-pan (aka Ken Burns) effect
  60. ### letterbox
  61. Transform a video in one size to another size using black letterboxes on the sides or top/bottom. Handy for embedding mobile videos into other screen formats
  62. ### split-silence
  63. Split an audio file according to silence
  64. # Complex Example
  65. Here is a complex example using multiple assets and operations:
  66. ```json
  67. {
  68. "assets": [
  69. {"name": "vid1", "path": "/tmp/path/to/video1.mp4"},
  70. {"name": "vid2", "path": "/tmp/path/to/video2.mp4"}
  71. ],
  72. "operations": [
  73. {
  74. "operation": "split", // name of the operation
  75. "creates": "vid1_split_%", // assets it creates, the '%' will be replaced with a counter
  76. "perform": {
  77. "split": "vid1", // split this source asset
  78. "interval": "10s" // split every ten seconds
  79. }
  80. },
  81. {
  82. "operation": "concat", // name of the operation
  83. "creates": "recombined_vid1", // assets it creates, the '%' will be replaced with a counter
  84. "perform": {
  85. "concat": ["vid1_split"] // recombine all split assets
  86. }
  87. },
  88. {
  89. "operation": "concat", // name of the operation
  90. "creates": "combined_vid", // asset it creates, can be referenced later
  91. "perform": {
  92. "concat": ["vid1", "vid2"] // operation-specific: this says, concatenate these named assets
  93. }
  94. },
  95. {
  96. "operation": "concat", // name of the operation
  97. "creates": "combined_vid", // the asset it creates, can be referenced later
  98. "perform": {
  99. "concat": ["vid1", "vid2"] // operation-specific: this says, concatenate these named assets
  100. }
  101. },
  102. {
  103. "operation": "overlay", // name of the operation
  104. "creates": "overlay1", // asset it creates
  105. "perform": {
  106. "source": "combined_vid1", // main video asset
  107. "overlay": "vid1", // overlay this video on the main video
  108. "start": "vid1.end_ts", // when (on the main video timeline) to start the overlay. default is 0 (beginning)
  109. "duration": "vid1.duration", // how long to play the overlay. default is to play the entire overlay asset
  110. "width": 400, // how wide the overlay will be, in pixels. default is "overlay.width"
  111. "height": 300, // how tall the overlay will be, in pixels. default is "overlay.height"
  112. "x": "source.width / 2", // horizontal overlay position. default is 0
  113. "y": "source.height / 2", // vertical overlay position. default is 0
  114. "out": "1080p", // this is a shortcut to the two lines below, and is the preferred way of specifying the output resolution
  115. "out_width": 1920, // output width in pixels. default is source width
  116. "out_height": 1024 // output height in pixes. default is source height
  117. }
  118. }
  119. ]
  120. }
  121. ```