Core class to login to your DeepWord account and generate synthetic videos

class DeepWord[source]

DeepWord(api_key:str, secret_key:str)

A class for logging into your DeepWord account in Python and generating videos at scale

account = DeepWord(API_KEY, SECRET_KEY)
login successful

Account details

DeepWord.available_credits[source]

Get the number of credits available in your DeepWord account.

account.available_credits
9986

DeepWord.list_videos[source]

DeepWord.list_videos()

Get a list of all the videos you've generated using your DeepWord account.

all_videos = account.list_videos()
all_videos[0]
{'email': 'test_dword_api@yopmail.com',
 'thumbnail': 'video_b47y6a4xnhkuexsb5a.mp4',
 'title': 'Henry_test',
 'video_url': 'https://videos-deep-word123.s3.us-east-2.amazonaws.com/output_data/b47y6a4xnhkuexsb5a.mp4',
 'video_duration': '25.032',
 'video_id': 'b47y6a4xnhkuexsb5a',
 'generate_date': '2021-10-06T03:13:48.000Z',
 'output_status': 'Progress'}
len(all_videos)
37

Downloading synthetically generated videos

DeepWord.download_video[source]

DeepWord.download_video(video_id:str)

Download one of the synthetically generated videos on your DeepWord account. The video id can be found using the list_generated_videos() function. The video should have finished processing to be downloadable. Optionally, you can use download_all_videos().

DeepWord.download_all_videos[source]

DeepWord.download_all_videos(folder:Union[str, Path]='downloaded_videos')

Download all vidoes generated with your DeepWord account. You can also pass a folder or nested folders where you want the vidoes to be saved.

account.download_all_videos('my_videos')
Successfully downloaded all videos in folder my_videos!
!ls my_videos | HEAD -n10
0_.mp4
10_.mp4
11_.mp4
12_.mp4
13_.mp4
14_.mp4
15_.mp4
16_.mp4
17_.mp4
18_.mp4

Downloading sample data

DeepWord.download_video_actors[source]

DeepWord.download_video_actors(folder='video_actors')

Download all the video actors available on the DeepWord website.

account.download_video_actors()
'Successfully downloaded all video actors'
!ls video_actors
Anna.mp4    Dalton.mp4  Isaac.mp4   Karen.mp4   Mia.mp4     Richard.mp4
Berto.mp4   Emily.mp4   James.mp4   Marcus.mp4  Micheal.mp4 Sam.mp4
Carlos.mp4  Henry.mp4   Julia.mp4   Mary.mp4    Noelle.mp4  Trey.mp4

DeepWord.download_audio_samples[source]

DeepWord.download_audio_samples(folder='audio_samples')

Download all the audio samples available on the DeepWord website

account.download_audio_samples()
'Successfully downloaded all audio samples'
!ls audio_samples
Amy Poehler.mp3            Mark Cuban.mp3
Boeing CEO.mp3             Martin Scorsese.mp3
Chamath Phalihapitiya.mp3  Michael Scott.mp3
Chinese Instructor.mp3     Neil deGrasse Tyson.mp3
Edward Snowden.mp3         Peyton Manning.mp3
Elizabeth Holmes.mp3       Scottie Pippen.mp3
Financial Advice.mp3       Shaq.mp3
Footbal Meme.mp3           Swim Coach.mp3
George Hotz.mp3            Tampa Bay Rays Manager.mp3
Kevin Hart.mp3             [Korean] Bong Joon Ho.mp3

Using text2speech

One of the big advantages of using DeepWord is you don't even have to record an audio. You can use our text2speech feature to convert your text into audio. We support a 41 languages and a bunch of speakers for each language. To see the available languages you can do

account._available_languages[:10]
['arabic_egypt',
 'arabic_saudi_arabia',
 'bulgarian',
 'catalan',
 'czech',
 'welsh',
 'danish',
 'german_austria',
 'german_switzerland',
 'german_germany']
lang = 'english_us'
speakers = account._available_speakers(lang)
speakers
['en-US-JennyNeural Female',
 'en-US-JennyMultilingualNeural Female',
 'en-US-GuyNeural Male',
 'en-US-AriaNeural Female',
 'en-US-AmberNeural Female',
 'en-US-AnaNeural Female',
 'en-US-AshleyNeural Female',
 'en-US-BrandonNeural Male',
 'en-US-ChristopherNeural Male',
 'en-US-CoraNeural Female',
 'en-US-ElizabethNeural Female',
 'en-US-EricNeural Male',
 'en-US-JacobNeural Male',
 'en-US-MichelleNeural Female',
 'en-US-MonicaNeural Female']
text = 'I want this speaker to speak this text'
account.text2speech(text, lang, speakers[1])
Successfully generated audio file text2speech.mp3
'text2speech.mp3'
play_audio('text2speech.mp3')

Trim videos

We trim videos on our servers for you so trim videos is part of the core module and not the utils module

DeepWord.trim_video[source]

DeepWord.trim_video(video:Union[str, Path], start_time:int, end_time:int, outfile:Union[str, Path]='trimmed_video.mp4')

Trim a video in place from start (secs) to end (secs). For youtube videos you can use download_youtube_video before trimming them.

fname = 'test_video.mp4'
display_video(fname)
account.trim_video(fname, 0, 5)
Successfully trimmed video
'trimmed_video.mp4'
display_video('trimmed_video.mp4')

Creating synthetic videos

DeepWord.generate_video[source]

DeepWord.generate_video(video:str, audio:str, title:str=None)

Generate a synthetic video using a video of a person talking and the audio you want them to say. You can check the status of the video using list_generated_videos and download it using download_video or download_all_videos Args: video (str): Video of the person you want talking. audio (str): Audio you want the person to say. title (str, optional): Optionally provide a title for the output. Defaults to name of the video file. Raises: ValueError: If video or audio don't exist

account.generate_video('video_actors/Anna.mp4', 'audio_samples/Amy Poehler.mp3')
{'status': True,
 'message': 'Your video has been added to the queue for processing. It should be complete within 10-15 minutes',
 'url': 'https://login.deepword.co/video/b47y6a4xnhkuexwhjh'}