movies as programs
play

Movies as Programs Leif Andersen Accessibility (prominent code) - PowerPoint PPT Presentation

Movies as Programs Leif Andersen Accessibility (prominent code) (some code) One down One down 19 more to go We Need Automation e Landscape Tool Example Experience Plugin-Ins Blender Script, AE Script UI Automation Apple Script


  1. Movies as Programs Leif Andersen

  2. Accessibility (prominent code) (some code)

  3. One down

  4. One down 19 more to go…

  5. We Need Automation

  6.  e Landscape Tool Example Experience Plugin-Ins Blender Script, AE Script UI Automation Apple Script (Macros) Shell Scripts FFmpeg, AVISynth

  7.  e Landscape Tool Example Experience Plugin-Ins Blender Script, AE Script UI Automation Apple Script (Macros) Shell Scripts FFmpeg, AVISynth

  8.  e Landscape Tool Example Experience Plugin-Ins Blender Script, AE Script UI Automation Apple Script (Macros) Shell Scripts FFmpeg, AVISynth

  9.  e Landscape Tool Example Experience Plugin-Ins Blender Script, AE Script UI Automation Apple Script (Macros) Shell Scripts FFmpeg, AVISynth

  10. We have a problem…

  11. We have a problem… We want to solve it in the problem domain's own language…

  12. We have a problem… We want to solve it in the problem domain's own language… DSLs are the "Ultimate Abstraction" Paul Hudak

  13. Make a DSL!

  14. Library

  15. Language Library

  16. Library

  17. Producers Filters Playlists Multitracks

  18. Producers

  19. Producers

  20. Producers render : Producer →

  21. Producers render : Producer → clip : String → Producer

  22. Producers render : Producer → clip : String → Producer (render (clip "demo.mp4")) ⇒

  23. Filters

  24. Filter Producer Producer

  25. (attach-filter bunny-clip (sepia-filter))

  26. (attach-filter bunny-clip (sepia-filter))

  27. Playlists

  28. Producer Producer Producer Producer Time

  29. (playlist (clip "jumping.mp4") (clip "flying.mp4"))

  30. Producer Producer Producer Producer Time

  31. Producer Producer Transition Producer Producer Time

  32. (playlist (clip "jumping.mp4") (fade-transition 1) (clip "flying.mp4"))

  33. Multitracks

  34. Producer Layers Producer Producer Producer Time

  35. Producer Layers Producer Merge Producer Producer Time

  36. (define WIDTH 1920) (define HEIGHT 1080) (multitrack (color "black") (overlay-merge 0 0 (/ WIDTH 2) HEIGHT) (clip "running.mp4") (overlay-merge (/ WIDTH 2) 0 (/ WIDTH 2) HEIGHT) (clip "flying.mp4"))

  37. Producers Filters Library Playlists Multitracks

  38. Language Producers Filters Library Playlists Multitracks

  39. Primitives

  40. List Comprehensions

  41. Modules

  42. Functions

  43. #lang video ;; Create a mosaic of four videos (for/vertical ([i (in-range 2)]) (for/horizontal ([j (in-range 2)]) (external-video "branded.vid" (clip "logo.png") (clip (format "~aX~a.mp4" i j)))))

  44. #lang video (clip "dragon.mp4") ;; Create a mosaic of four videos (for/vertical ([i (in-range 2)]) (for/horizontal ([j (in-range 2)]) (external-video "branded.vid" (clip "logo.png") (clip (format "~aX~a.mp4" i j)))))

  45. Implementing Video Manual Editing + Editing

  46. From Libraries to Languages

  47. We make DSLs using Linguistic Inheritance

  48. We make DSLs using Linguistic Inheritance

  49. Movie Script We make DSLs using Linguistic Inheritance Video Implementation Racket

  50. Movie Script We make DSLs using Linguistic Inheritance Re-export construct Video Implementation Racket

  51. Movie Script We make DSLs using Linguistic Inheritance Re-export construct Video Implementation Remove construct Racket

  52. Movie Script We make DSLs using Linguistic Inheritance Re-export construct New construct Video Implementation Remove construct Racket

  53. Movie Script We make DSLs using Linguistic Inheritance Re-export construct New construct Video Implementation Remove construct Change construct Racket

  54. (for/playlist ([scene (in-list scene-list)]) (multitrack scene (overlay-merge 10 10 300 300) (clip "logo.mp4")))

  55. (define (for/playlist seq body) (apply playlist (for/list ([i (in-list seq)]) (body i))))

  56. (define (for/playlist seq body) (apply playlist (for/list ([i (in-list seq)]) (body i)))) > (for/playlist (list (clip "a.mp4") (clip "b.mp4")) ( λ (scene) (multitrack scene (overlay-merge 10 10 300 300) (clip "logo.mp4"))))

  57. (define-macro (for/playlist seq . body) `(apply playlist (for/list ,seq ,@body)))

  58. (for/playlist ([s (list (clip "a.mp4"))]) (multitrack ...)) ⇒ elaborates (apply playlist (for/list ([s (list (clip "a.mp4"))]) (multitrack ....)))

  59. (for/playlist ([s (list (clip "a.mp4"))]) (multitrack ...)) ⇒ elaborates (apply playlist (for/list ([s (list (clip "a.mp4"))]) (multitrack ....))) ⇒ evaluates #<playlist>

  60. (let ([playlist 42]) (for/playlist ....))

  61. (let ([playlist 42]) (for/playlist ....)) ⇒ elaborates (let ([playlist 42]) (apply playlist ....))

  62. (let ([playlist 42]) (for/playlist ....)) ⇒ elaborates (let ([playlist 42]) (apply playlist ....)) ⇒ evaluates

  63. (define-macro (for/playlist seq . body) `(apply playlist (for/list ,seq ,@body))) > (let ([playlist 42]) (for/playlist ([s (list (clip "a.mp4"))]) (multitrack s (overlay-merge 10 10 300 300) (clip "logo.mp4"))))

  64. (define-syntax-rule (for/playlist seq body ...) (apply playlist (for/list seq body ...)))

  65. (define-syntax-rule (for/playlist seq body ...) (apply playlist (for/list seq body ...))) > (let ([playlist 42]) (for/playlist ([s (list (clip "a.mp4"))]) (multitrack s (overlay-merge 10 10 300 300) (clip "logo.mp4"))))

  66. Non-Local Language Features

  67. #lang video logo (define logo ...) talk (define talk ...) logo

  68. #lang video (provide vid) (define logo ...) (define talk ...) (define vid (playlist logo talk logo ))

  69. Interposition Points #%app #%module-begin

  70. (+ 1 2) ⇒ elaborates (#%app + 1 2)

  71. #lang video (module anon video ( #%module-begin logo logo parses talk talk (define logo ...) ;; Where (define talk ...))) (define logo ...) (define talk ...)

  72. (module anon video (module anon racket ( #%module-begin ( #%module-begin logo (require vidlib) elaborates talk (define logo (define logo ...) ...) (define talk (define talk ...) ...))) (vid-begin vid logo talk)))

  73. #lang racket

  74. (require syntax/wrapping-modbeg) (define-syntax video-module-begin (make-wrapping-module-begin ...))

  75. (require syntax/wrapping-modbeg) (define-syntax video-module-begin (make-wrapping-module-begin ...))

  76. #lang racket/base ... run time code ... (define-syntax macro-name ... compile time code ...) ... run time code ...))

  77. (define-syntax id expr) id : run time binding expr : compile time expression

  78. Movies as Programs: A Tower of Languages

  79. FFI

  80. 101010 010101 Source File Video Data Structure FFmpeg Filter Graph Runtime Output

  81. FFI V We have a problem…

  82. FFI V We have a problem… We want to solve it in the problem domain's own language…

Recommend


More recommend