Javicle - a JSON Video Composition Language
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # Javicle - a JSON Video Composition Language
  2. JVCL (pronounced "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. INCR=10
  10. for ((i=10;i<130;i=(i+INCR))); do
  11. ffmpeg -i /tmp/my/source.mp4 -ss ${i} -t $((i+INCR)) /tmp/my/slice_${i}_$((i+INCR)).mp4
  12. done
  13. ```
  14. With JVCL, you'd create this spec:
  15. ```json
  16. {
  17. "assets": [ {"name": "src", "path": "/tmp/my/source.mp4"} ],
  18. "operations": [{
  19. "operation": "split",
  20. "creates": "src_splits",
  21. "perform": {
  22. "split": "src",
  23. "interval": "10s",
  24. "start": "10s",
  25. "end": "130s"
  26. }
  27. }]
  28. }
  29. ```
  30. Yes, the JVCL is longer, but I think many would agree it is easier to read and maintain.
  31. As the number of input assets and operations grows, hand-crafted shell scripts with magical
  32. ffmpeg incantations become ever more inscrutable.
  33. JVCL is designed for readability and maintainability. JVCL will continue to evolve towards greater
  34. coverage of the full capabilities of ffmpeg. We also plan to introduce "function" concepts
  35. to create reusable compound operations, further increasing reusability and lowering long-term
  36. maintenance.
  37. # Who is JVCL not for?
  38. If you like GUIs, JVCL is probably not for you.
  39. JVCL is not a replacement for Final Cut Pro or even iMovie.
  40. # Who is JVCL for?
  41. If you like CLIs, JVCL might be for you.
  42. You might enjoy JVCL if your video composition needs are relatively simple or
  43. if you enjoy capturing repeatable processes in source control.
  44. # Concepts
  45. In JVCL there are two main concepts: assets and operations.
  46. ## Assets
  47. Assets are the inputs: generally image, audio and video files. Assets have a name and a path.
  48. The path can be a file or a URL.
  49. ## Operations
  50. Operations are transformations to perform on the inputs.
  51. An operation can produce one or more new assets, which can then be referenced in
  52. later operations.
  53. The operations that JVCL either supports or intends to support are:
  54. ### split
  55. Split an audio/video asset into multiple assets
  56. ### concat
  57. Concatenate audio/video assets together into one asset
  58. ### trim
  59. Trim audio/video; crop a section of an asset, becomes a new asset
  60. ### overlay
  61. Overlay one audio or video file onto another
  62. ### ken-burns
  63. For transforming still images into video via a fade-pan (aka Ken Burns) effect
  64. ### letterbox
  65. 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
  66. ### split-silence
  67. Split an audio file according to silence
  68. # Complex Example
  69. Here is a complex example using multiple assets and operations:
  70. ```json
  71. {
  72. "assets": [
  73. {"name": "vid1", "path": "/tmp/path/to/video1.mp4"},
  74. {"name": "vid2", "path": "/tmp/path/to/video2.mp4"}
  75. ],
  76. "operations": [
  77. {
  78. "operation": "split", // name of the operation
  79. "creates": "vid1_split_%", // assets it creates, the '%' will be replaced with a counter
  80. "perform": {
  81. "split": "vid1", // split this source asset
  82. "interval": "10s" // split every ten seconds
  83. }
  84. },
  85. {
  86. "operation": "concat", // name of the operation
  87. "creates": "recombined_vid1", // assets it creates, the '%' will be replaced with a counter
  88. "perform": {
  89. "concat": ["vid1_split"] // recombine all split assets
  90. }
  91. },
  92. {
  93. "operation": "concat", // name of the operation
  94. "creates": "combined_vid", // asset it creates, can be referenced later
  95. "perform": {
  96. "concat": ["vid1", "vid2"] // operation-specific: this says, concatenate these named assets
  97. }
  98. },
  99. {
  100. "operation": "concat", // name of the operation
  101. "creates": "combined_vid", // the asset it creates, can be referenced later
  102. "perform": {
  103. "concat": ["vid1", "vid2"] // operation-specific: this says, concatenate these named assets
  104. }
  105. },
  106. {
  107. "operation": "overlay", // name of the operation
  108. "creates": "overlay1", // asset it creates
  109. "perform": {
  110. "source": "combined_vid1", // main video asset
  111. "overlay": "vid2", // overlay this video on the main video
  112. "offset": "30", // when (on the main video timeline) to begin showing the overlay. default is 0 (beginning)
  113. "overlayStart": "0", // when (on the overlay video timeline) to begin playback on the overlay. default is 0 (beginning)
  114. "overlayEnd": "0", // when (on the overlay video timeline) to end playback on the overlay. default is to play the whole overlay
  115. "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
  116. "height": "", // how tall the overlay will be, in pixels. default is the full overlay height, or maintain aspect ratio if width was set
  117. "x": "source.width/2", // horizontal overlay position on main video. default is 0
  118. "y": "source.height/2", // vertical overlay position on main video. default is 0
  119. "outputWidth": "1920", // output width in pixels. default is source width
  120. "outputHeight": "1024" // output height in pixes. default is source height
  121. }
  122. }
  123. ]
  124. }
  125. ```
  126. ## What's up with the name?
  127. I dunno, a cross between a javelin and an icicle? does that have any positive connotations? ok then...