Skip to content

Commit

Permalink
Cleaning and a link
Browse files Browse the repository at this point in the history
  • Loading branch information
tjunttila committed Aug 4, 2020
1 parent 36142b7 commit bae6be8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
into a video narrated by the [Amazon Polly](https://aws.amazon.com/polly/) text-to-speech engine.
It can be used to generate, for instance, educational videos.

Please see this [sample video](https://users.aalto.fi/tjunttil/pdf2video.mp4),
produced with the tool, for a short introduction.

# Requirements

Using `pdf2video.py` requires the following external tools and services:
Expand All @@ -26,7 +29,8 @@ python3 pdf2video.py presentation.pdf script.txt video.mp4
```
converts the PDF file `presentation.pdf` and the script `script.txt` into
the video `video.mp4` narrated by the default voice (Amazon Polly standard voice Joanna in the current version).
The selected PDF pages as well as the narration voice can be changed easily, for instance, as follows:
The selected PDF pages as well as the narration voice can be changed easily.
For instance, the [sample video](https://users.aalto.fi/tjunttil/pdf2video.mp4) was produced witth the command
```
python3 pdf2video.py sample.pdf sample.txt --pages "1,2,4-6" --voice Matthew --neural --conversational sample.mp4
```
Expand Down
24 changes: 12 additions & 12 deletions parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ def parse(string, neural):
sub = "".join([node.to_sub() for node in ast])
return (ssml, words, sub)

if __name__ == '__main__':
ast = parse("#sub#*@NP@-complete problem*#NPC problem#, Fourier-Motzkin")
print(ast)
print(">"+"".join([node.to_ssml(True) for node in ast])+"<")
words = []
for node in ast:
words += node.to_words()
print(words)

sub = "".join([node.to_sub() for node in ast])
print(sub)
#print(ast.to_sub())
#if __name__ == '__main__':
# ast = parse("#sub#*@NP@-complete problem*#NPC problem#, Fourier-Motzkin")
# print(ast)
# print(">"+"".join([node.to_ssml(True) for node in ast])+"<")
# words = []
# for node in ast:
# words += node.to_words()
# print(words)
#
# sub = "".join([node.to_sub() for node in ast])
# print(sub)
# #print(ast.to_sub())
2 changes: 1 addition & 1 deletion pdf2video.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def execute(cmd):
except Exception as err:
error(f'Error when executing "{cmd}".\n'+str(err))
if r.returncode != 0:
print(" ".join(r.args))
#print(" ".join(r.args))
error(f'Error when executing "{cmd}". The last 10 lines of the stderr output is as follows:\n' + '\n'.join((r.stderr.decode('utf-8').split('\n'))[-11:]))
return r
def make_dir(dir_name):
Expand Down

0 comments on commit bae6be8

Please sign in to comment.