How We Generate Videos from Screenplay Files
Hi, I’m Matthew from OpenResty Inc. Today I’d like to share how we generate our tutorial videos via the OpenResty Showman tool chain.
uname -a
cd ~/git/ordemo2/
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
.
vim bash.sp
In this example, we try to explain some basic bash usage.
We make the following edits:
- 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.
- Note that shell commands all have an indentation.
- 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.
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 Showman tool chain to process this screenplay file. This file contains all the necessary information needed for generating the final video.
./gen bash.sp
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.
opslang -h | less
The second step is to generate the audio as a bunch of MP3 files.
./gen-audio.sh
Finally, we generate the final video file.
./gen-video.sh bash
We’re all set! We can now check the generated files ready for being uploaded to YouTube.
ls -lh bash.mp4 bash.srt
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.
../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.
If you like this tutorial, please subscribe to this blog site and our YouTube channel. Thank you!
About The Author
Yichun Zhang (Github handle: agentzh), is the original creator of the OpenResty® open-source project and the CEO of OpenResty Inc..
Yichun is one of the earliest advocates and leaders of “open-source technology”. He worked at many internationally renowned tech companies, such as Cloudflare, Yahoo!. He is a pioneer of “edge computing”, “dynamic tracing” and “machine coding”, with over 22 years of programming and 16 years of open source experience. Yichun is well-known in the open-source space as the project leader of OpenResty®, adopted by more than 40 million global website domains.
OpenResty Inc., the enterprise software start-up founded by Yichun in 2017, has customers from some of the biggest companies in the world. Its flagship product, OpenResty XRay, is a non-invasive profiling and troubleshooting tool that significantly enhances and utilizes dynamic tracing technology. And its OpenResty Edge product is a powerful distributed traffic management and private CDN software product.
As an avid open-source contributor, Yichun has contributed more than a million lines of code to numerous open-source projects, including Linux kernel, Nginx, LuaJIT, GDB, SystemTap, LLVM, Perl, etc. He has also authored more than 60 open-source software libraries.