Hi, I’m Matthew from OpenResty Inc. Today I’d like to share how we generate our tutorial videos via the OpenResty Demo tool chain.

1
2
uname -a
cd ~/git/ordemo2/

How We Generate Videos from Screenplay Files_java

Yes, our videos were all automatically generated, including the video associated with this article.

Basically humans just write a screenplay file for each video. Let’s create an example file, bash.sp.

1
vim bash.sp

In this example, we try to explain some basic bash usage.

We make the following edits:

  1. The first paragraph is some narrator which computer will eventually speak out in the final video. And as you might have have guessed, I, Matthew, am a computer voice. And while speaking this sentence, we can make the machine do something in the terminal.
  2. Note that shell commands all have an indentation.
  3. And we can also pause the terminal operation, and speak something. Note the [S] prefix of a paragraph which means “synchronous”. By default, it is asynchronous.
1
2
3
4
5
6
7
8
9
10
11
Today I'll demonstrate some bash usage.

   ps -p "$$"

[S] As we can see we are currently in a bash session.

Let's do a hello world in bash.

   echo 'hello world!'

[S] We can see the hello world string is printed.

We can use our OpenResty Demo tool chain to process this screenplay file. This file contains all the necessary information needed for generating the final video.

1
./gen bash.sp

How We Generate Videos from Screenplay Files_java_02

It now completes processing the screenplay file. It has also finished executing all the shell commands which can be replayed.

We use our Ops language tool chain to automate the terminal operations.

1
opslang -h | less

The second step is to generate the audio as a bunch of MP3 files.

1
./gen-audio.sh

How We Generate Videos from Screenplay Files_java_03

Finally, we generate the final video file.

1
./gen-video.sh bash

How We Generate Videos from Screenplay Files_java_04

We’re all set! We can now check the generated files ready for being uploaded to YouTube.

1
ls -lh bash.mp4 bash.srt

How We Generate Videos from Screenplay Files_java_05

The MP4 file is the video file. And the SRT file is the corresponding subtitles with accurate timing information.

Web browser operations can be automated by our Nav language tool chain.

1
../navlang/navlang -h | less

We’ll cover this web topic in a separate video.

The generated bash video was appended to the video shown at the beginning of this post.

How We Generate Videos from Screenplay Files_java_06

If you like this tutorial, please subscribe to this blog site and our YouTube channel. Thank you!

About This Article and Associated Video

This article and its associated video are both generated automatically from a simple screenplay file.

Boost your application's performance by OpenResty XRay

About The Author

Yichun Zhang is the creator of the OpenResty® open source project. He is also the founder and CEO of the OpenResty Inc. company. He contributed a dozen open source Nginx 3rd-party modules, quite some Nginx and LuaJIT core patches, and designed the OpenResty XRay platform.

Translations

We provide the Chinese translation for this article on blog.openresty.com.cn. We also welcome interested readers to contribute translations in other natural languages as long as the full article is translated without any omissions. We thank them in advance.

We are hiring

We always welcome talented and enthusiastic engineers to join our team at OpenResty Inc. to explore various open source software’s internals and build powerful analyzers and visualizers for real world applications built atop the open source software. If you are interested, please send your resume totalents@openresty.com . Thank you!