Skip to main content

Package to convert audio to video with google speech to text and google image search

Project description

OWOI_AudioToClip

Python module used for the school project OWOI (One Word One Image)

Installation

After git cloning the repository, you can install the dependencies with the following command:

poetry install

Credentials

Please provide your credentials in the following environment variables:

export GOOGLE_APPLICATION_CREDENTIALS="path/to/credentials.json"
export GOOGLE_IMAGES_SEARCH_TOKEN="token"
export GOOGLE_SEARCH_ID="id"

Classes

TranscriptFactory

This class is used to create a transcript from a text file. It will create a list of words and a list of timestamps.

from audio_to_clip import ClipMakerFactory

transcript_factory = TranscriptFactory(gcs_uri="gs://bucket/file.mp3")

Methods:

  • transcribe_audio_to_text() -> list[dict]: transcribe audio to text from the gcs_uri and returns a list of dict with the following keys: "word", "start_time" and "end_time"
  • get_word_timestamps() -> list[dict]: returns a list of dict with the following keys: "word", "start_time" and "end_time"

This Class should be used to create a transcript from a text file before creating a clip with the ClipMakerFactory.

ClipMakerFactory

This class is used to create a clip from a transcript.

from audio_to_clip import ClipMakerFactory

clip_makfer_factory = ClipMagerFactory(video_name, username, transcript, gcs_bucket_dest, local_storage_dest, gcs_bucket_audio)

Params:

  • video_name:str -> name of the video
  • username:str -> name of the user
  • transcript:list[WordTimestamp] -> list of WordTimestamp
  • gcs_bucket_dest:str -> name of the gcs bucket destination
  • local_storage_dest:str -> path to the local storage destination
  • gcs_bucket_audio:str -> name of the gcs bucket where the audio is stored

Methods:

  • clip_maker(word_timestamps: list[WordTimestamp]) -> VideoFileClip: creates a clip from the transcript and returns a VideoFileClip
  • upload_video_to_gcs() -> None: uploads the video to the gcs bucket with the name: username/video_name.mp4, should be called after clip_maker

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

owoi-audiotoclip-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

owoi_audiotoclip-0.1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file owoi-audiotoclip-0.1.1.tar.gz.

File metadata

  • Download URL: owoi-audiotoclip-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.9.7 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for owoi-audiotoclip-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d97324d3f4f30a0d6cb802a4717de4f0f85d733b69ec30da85782c2cb89c370
MD5 fe510f566800ff1eda040b5b0f8333b2
BLAKE2b-256 5c95cecc89b30a91990f270f7715ffad4d2e8ba3ea5e2fd0b572ce768617735f

See more details on using hashes here.

File details

Details for the file owoi_audiotoclip-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: owoi_audiotoclip-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.9.7 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for owoi_audiotoclip-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2119cf8431fbbbc573468b161ad781691b602b82daeb1c9b79a03744e53b6a6
MD5 0013457e986ea3604792de6c56921aef
BLAKE2b-256 2b89f9fbc6bf69d99a79ab1adeb2643856525962fda08d53581c1bf8a7e033a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page