|
| 1 | +# touying2video |
| 2 | + |
| 3 | +The tools converts a touying-typ presentation slide to a presentation video with voice over. |
| 4 | +It is currently in its proof-of-concept stage. |
| 5 | +To use this tool, import `p2vmeta.typ` in your Typst file. ~~Currently, it only works with a patched version of `touying-typ`.~~ (No longer needed, as we have found a workaround.) The file to import (`p2vmeta.typ`) is available in the `demo` directory. A demo video is available at <https://youtu.be/lJ7X57xG7V8>. |
| 6 | + |
| 7 | + |
| 8 | +## Quick start |
| 9 | + |
| 10 | +A demo file is available at `demo/demo.typ`. To use the tool, add the following lines at the beginning of your Typst file: |
| 11 | + |
| 12 | +```typst |
| 13 | +#import "@preview/touying:0.6.1": * |
| 14 | +// #import "p2vmeta.typ": * // The typst portion of the tool |
| 15 | +#import "@preview/touying2video:0.1.0": * |
| 16 | +
|
| 17 | +#t2sdefaults( // Set the default settings for the tool |
| 18 | + transition: "fade", |
| 19 | + transition_duration: 0.8, |
| 20 | +) |
| 21 | +
|
| 22 | +#pdfpc.config(// You may also set defaults for the pdfpc module in touying-typ |
| 23 | + disable-markdown: false, |
| 24 | + default-transition: ( |
| 25 | + type: "fade", |
| 26 | + duration-seconds: 1, |
| 27 | + ), |
| 28 | +) |
| 29 | +
|
| 30 | +#import themes.university: * |
| 31 | +
|
| 32 | +#import "@preview/numbly:0.1.0": numbly |
| 33 | +
|
| 34 | +#show: university-theme.with( |
| 35 | + // ... The setting for your theme |
| 36 | +) |
| 37 | +``` |
| 38 | + |
| 39 | +**Very import**: At the end of your Typst file, add the following lines: |
| 40 | + |
| 41 | +```typst |
| 42 | +#context t2s-file(here()) |
| 43 | +``` |
| 44 | + |
| 45 | +After compiling the Typst file, run the following command to generate the video: |
| 46 | + |
| 47 | +```bash |
| 48 | +python main.py path/to/your/typst/file.typ |
| 49 | +``` |
| 50 | + |
| 51 | + |
| 52 | +## Reference |
| 53 | + |
| 54 | +The following tags are provided: |
| 55 | +- `t2sdefaults`: the default settings for the tool |
| 56 | + - `duration_logical`: the duration of each (physical) slide in seconds |
| 57 | + - `transition`: the transition effect between slides, currently, only `"fade"` and `"none"` are supported |
| 58 | + - `transition_duration`: the duration of the transition effect in seconds, if the transition is set to `"none"`, this parameter must be 0. |
| 59 | +- `t2s`: the content of speech |
| 60 | + - By default, a transition to a new slide with a speech will not happen until the current speech finishes. |
| 61 | +- `duration`: the duration of the slide in seconds |
| 62 | + - `logical`: the duration of the (logical) slide in seconds |
| 63 | + - Please note that this parameter will behave funny when you have a speech in the slide that is not starting at the first physical slide of this logical slide. |
| 64 | + - `physical`: the duration of each (physical) slide in seconds |
| 65 | + - The following special values are allowed: |
| 66 | + - `"fk"`, i.e., `f` followed by an integer: until the finish of the k-th speech in the logical slide, k starts from 1 |
| 67 | + <!-- - `"fk+t"`, i.e., `f` followed by an integer, a `+`, and a float: until the finish of the k-th speech in the logical slide plus the specified time--> |
| 68 | + - Note that, the time specified here is more similar to "minimal time", because the tool will wait for the speech to finish before transitioning to the next slide (if the next slide has a speech) |
| 69 | +- `video-overlay` |
| 70 | + - `start`: in which physical slide in this logical slide that the video overlay starts |
| 71 | + - All dimensions can be in pixels or percentage of the slide size |
| 72 | + - one of width or height can be negative, in which case, the size is calculated from the other dimension, preserving the aspect ratio of the video |
| 73 | + - if both are negative, the video is not resized |
| 74 | + - Currently, typst and touying do not support putting a video in the presentation slides. However, we provide a method to insert video clips in the presentation video. |
| 75 | + |
| 76 | + |
| 77 | +## Video overlay in the presentation video |
| 78 | + |
| 79 | + |
| 80 | +Example: |
| 81 | + |
| 82 | +```typst |
| 83 | + video-overlay( |
| 84 | + start_from: 2, |
| 85 | + video: "img/animations/video1.mp4", |
| 86 | + x: 20%, // relative to the slide width |
| 87 | + y: 40%, // relative to the slide height |
| 88 | + width: 18%, // relative to the slide width |
| 89 | + ) |
| 90 | +``` |
| 91 | + |
| 92 | + |
| 93 | +## License |
| 94 | + |
| 95 | +[aGPL-3.0](https://github.com/yangwenbo99/touying2video/blob/main/LICENSE) |
0 commit comments