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.

complex_example.md 8.2 KiB

4 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. # Complex Example
  2. Here is a complex example using multiple assets and operations.
  3. Note that comments, which are not usually legal in JSON, are allowed in JVCL files.
  4. If you have other JSON-aware tools that need to read JVLC files, you may not want to
  5. use this comment syntax. The `asset` and `operation` JSON objects also support a `comment`
  6. field, which can be used as well.
  7. ```js
  8. {
  9. "assets": [
  10. // file -- will be referenced directory
  11. {
  12. "comment": "first video, already local",
  13. "name": "vid1",
  14. "path": "/tmp/path/to/video1.mp4"
  15. },
  16. // URL -- will be downloaded to scratch directory and referenced from there
  17. {
  18. "comment": "second video, will be downloaded",
  19. "name": "vid2",
  20. "path": "https://archive.org/download/gov.archives.arc.1257628/gov.archives.arc.1257628_512kb.mp4"
  21. },
  22. // URL -- will be downloaded to `dest` directory and referenced from there
  23. {
  24. "comment": "third video, will be downloaded",
  25. "name": "vid3",
  26. "path": "https://archive.org/download/gov.archives.arc.49442/gov.archives.arc.49442_512kb.mp4",
  27. "dest": "src/test/resources/sources/"
  28. },
  29. // Image URL
  30. {
  31. "comment": "JPEG image, will be downloaded",
  32. "name": "img1",
  33. "path": "https://live.staticflickr.com/65535/48159911972_01efa0e5ea_b.jpg",
  34. "dest": "src/test/resources/sources/"
  35. }
  36. ],
  37. "operations": [
  38. // scale examples
  39. {
  40. "comment": "scale using explicity height x width",
  41. "operation": "scale", // name of the operation
  42. "creates": "vid2_scaled", // asset it creates
  43. "source": "vid2", // source asset
  44. "width": "1024", // width of scaled asset. if omitted and height is present, width will be proportional
  45. "height": "768" // height of scaled asset. if omitted and width is present, height will be proportional
  46. },
  47. {
  48. "comment": "scale proportionally by a scale factor",
  49. "operation": "scale", // name of the operation
  50. "creates": "vid2_big", // asset it creates
  51. "source": "vid2", // source asset
  52. "factor": "2.2" // scale factor. if factor is set, width and height are ignored.
  53. },
  54. // split example
  55. {
  56. "comment": "split one asset into many",
  57. "operation": "split", // name of the operation
  58. "creates": "vid1_split_%", // assets it creates, the '%' will be replaced with a counter
  59. "source": "vid1", // split this source asset
  60. "interval": "10" // split every ten seconds
  61. },
  62. // concat examples
  63. {
  64. "comment": "re-combine previously split assets back together",
  65. "operation": "concat", // name of the operation
  66. "creates": "recombined_vid1", // assets it creates, the '%' will be replaced with a counter
  67. "source": ["vid1_split"] // recombine all split assets
  68. },
  69. {
  70. "comment": "append vid2 to the end of vid1 and create a new asset",
  71. "operation": "concat", // name of the operation
  72. "creates": "combined_vid2", // asset it creates, can be referenced later
  73. "source": ["vid1", "vid2"] // operation-specific: this says, concatenate these named assets
  74. },
  75. {
  76. "comment": "re-combine only some of the previously split assets",
  77. "operation": "concat", // name of the operation
  78. "sources": ["vid1_splits[1..2]"],// concatentate these sources -- the 2nd and 3rd files only
  79. "creates": "combined_vid3" // name of the output asset, will be written to scratch directory
  80. },
  81. // trim example
  82. {
  83. "comment": "trim all of the assets that were split above",
  84. "operation": "trim", // name of the operation
  85. "creates": { // create multiple files, will be prefixed with `name`, store them in `dest`
  86. "name": "vid1_trims",
  87. "dest": "src/test/resources/outputs/trims/"
  88. },
  89. "source": "vid1_split", // trim these source assets
  90. "start": "1", // cropped region starts here, default is zero
  91. "end": "6" // cropped region ends here, default is end of video
  92. },
  93. // overlay example
  94. {
  95. "comment": "overlay one video onto another",
  96. "operation": "overlay", // name of the operation
  97. "creates": "overlay1", // asset it creates
  98. "source": "combined_vid1", // main video asset
  99. "start": "30", // when (on the main video timeline) to begin showing the overlay. default is 0 (beginning)
  100. "end": "60", // when (on the main video timeline) to stop showing the overlay. default is to play the entire overlay
  101. "overlay": {
  102. "source": "vid2", // overlay this video on the main video
  103. "start": "0", // when (on the overlay video timeline) to begin playback on the overlay. default is 0 (beginning)
  104. "end": "overlay.duration", // when (on the overlay video timeline) to end playback on the overlay. default is to play the entire overlay
  105. "width": "overlay.width / 2", // how wide the overlay will be, in pixels. default is the full overlay width, or maintain aspect ratio if height was set
  106. "height": "source.height", // how tall the overlay will be, in pixels. default is the full overlay height, or maintain aspect ratio if width was set
  107. "x": "source.width / 2", // horizontal overlay position on main video. default is 0
  108. "y": "source.height / 2" // vertical overlay position on main video. default is 0
  109. }
  110. },
  111. // ken-burns example
  112. {
  113. "comment": "apply zoom-pan effect to image, creates video",
  114. "operation": "ken-burns", // name of the operation
  115. "creates": "ken1", // asset it creates
  116. "source": "img1", // source image
  117. "zoom": "1.3", // zoom level, from 1 to 10
  118. "duration": "5", // how long the resulting video will be
  119. "start": "0", // when to start zooming, default is 0
  120. "end": "duration", // when to end zooming, default is duration
  121. "x": "source.width * 0.6", // pan to this x-position
  122. "y": "source.height * 0.4", // pan to this y-position
  123. "upscale": "8", // upscale factor. upscaling the image results in a smoother pan, but a longer encode, default is 8
  124. "width": "1024", // width of output video
  125. "height": "768" // height of output video
  126. },
  127. // letterbox example
  128. {
  129. "comment": "increase video size without scaling, add letterboxes as needed",
  130. "operation": "letterbox", // name of the operation
  131. "creates": "boxed1", // asset it creates
  132. "source": "ken1", // source asset
  133. "width": "source.width * 1.5", // make it wider
  134. "height": "source.height * 0.9", // and shorter
  135. "color": "AliceBlue" // default is black. can be a hex value (0xff0000 for red) or a color name from here: https://ffmpeg.org/ffmpeg-utils.html#color-syntax
  136. },
  137. // remove-track examples
  138. {
  139. "comment": "remove all audio tracks",
  140. "operation": "remove-track", // name of the operation
  141. "creates": "vid2_video_only", // name of the output asset
  142. "source": "vid2", // main video asset
  143. "track": "audio" // remove all audio tracks
  144. },
  145. {
  146. "comment": "remove all video tracks",
  147. "operation": "remove-track", // name of the operation
  148. "creates": "vid2_audio_only", // name of the output asset
  149. "source": "vid2", // main video asset
  150. "track": "video" // remove all video tracks
  151. },
  152. {
  153. "comment": "remove a specific audio track",
  154. "operation": "remove-track", // name of the operation
  155. "creates": "vid2_video_only2", // name of the output asset
  156. "source": "vid2", // main video asset
  157. "track": {
  158. // only remove the first audio track
  159. "type": "audio", // track type to remove
  160. "number": "0" // track number to remove
  161. }
  162. }
  163. ]
  164. }
  165. ```