Skip to main content

Extract frames and a transcript from a single video.

Project description

clip-digest

Extract timestamped frames and a transcript from a single video


❶ Requirements

  • Python 3.10+
  • ffmpeg on PATH — frame extraction
  • openai-whisper — installed as a dependency, handles transcription

❷ Installation

Install from PyPI:

pip install clip-digest

Install from a local checkout:

pip install .

❸ Usage

Call run with a video path — balanced defaults apply when no config is passed:

from clip_digest import Config, run

result = run(video_path="meeting.mp4")

print(result.frame_count)      # frames written
print(result.frames_dir)       # output/meeting/frames
print(result.transcript_dir)   # output/meeting/transcript

for segment in result.segments:
    print(segment.start, segment.text)

Override only what a case needs:

result = run(video_path="demo.mp4", config=Config(frame_rate=2.0, image_format="png"))

Build a config from a dict — unknown keys are rejected:

config = Config.from_dict({"frame_rate": 0.5, "language": "es", "quality": 80})
result = run(video_path="entrevista.mp4", config=config)

❹ Result

Field Type Contains
frame_count int Frames written
frames_dir Path | None Frame output directory
transcript_dir Path | None Transcript output directory
segments list[Segment] Timestamped transcript segments

Each Segment carries start · end · text.


❺ Configuration

The transcription model is fixed internally — transcription behaves identically across every case. Everything below is adjustable.

Option Default Does Adjust when
frame_rate 1.0 Frames sampled per second Raise for fast motion, lower for screencasts
quality 85 webp and jpg quality, 1 to 100 Lower to shrink files, raise for fidelity
compression_level 6 webp and png effort, 0 to 6 Lower for faster extraction on long videos
image_format "webp" Frame format — webp png jpg Use png for lossless frames feeding OCR
frame_pattern "frame_%04d" printf stem for frame files Match an external naming scheme
language None Language code, or auto detect Set when language is known to skip detection
start_time None First second to process Skip leading footage
end_time None Last second to process Skip trailing footage
output_root "output" Base output directory Redirect results elsewhere
should_extract_frames True Extract frames Disable to transcribe only
should_transcribe True Transcribe audio Disable to extract frames only
should_write_manifest True Write the frame timestamp manifest Disable when only images are needed
should_time_words True Word level timestamps for tight bounds Disable for faster transcription

❻ Output Layout

output/<video_stem>/
├── frames/
│   ├── frame_0001.webp
│   └── manifest.json
└── transcript/
    └── transcript.json

❼ Command Line

clip-digest meeting.mp4 --frame-rate 2 --image-format png
clip-digest meeting.mp4 --only-transcript --language en
Flag Default Does
--output-root output Base output directory
--frame-rate 1.0 Frames sampled per second
--quality 85 webp and jpg quality, 1 to 100
--image-format webp Frame format — webp png jpg
--language auto Language code, or omit to detect
--start-time none Trim start — SS MM:SS HH:MM:SS
--end-time none Trim end — SS MM:SS HH:MM:SS
--only-frames off Extract frames only
--only-transcript off Transcribe only

❽ Errors

Branch on typed errors — all subclass VideoDigestError:

from clip_digest import run, VideoNotFoundError, MissingDependencyError, ConfigError

try:
    result = run(video_path=path)
except VideoNotFoundError:
    ...   # pick another file
except MissingDependencyError:
    ...   # report environment problem
except ConfigError:
    ...   # fix parameters and retry
Error Raised when
VideoNotFoundError Video path does not exist
MissingDependencyError ffmpeg or whisper unavailable
ConfigError Invalid or unknown config parameter
ExtractionError Frame or transcript extraction fails
VideoDigestError Base class for all of the above

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

clip_digest-1.0.2.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

clip_digest-1.0.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file clip_digest-1.0.2.tar.gz.

File metadata

  • Download URL: clip_digest-1.0.2.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for clip_digest-1.0.2.tar.gz
Algorithm Hash digest
SHA256 858c183a3ad751f2dc5bb26c80715bc8a57a6d95427dfd88e22853b9850bb934
MD5 c7702429a5609cb8bfd80705d659f369
BLAKE2b-256 a754af389da5c8e5214abf0652cdcff3947bba17efe5381c3449e081e3bf3bab

See more details on using hashes here.

Provenance

The following attestation bundles were made for clip_digest-1.0.2.tar.gz:

Publisher: release.yml on roHIT-MAN-45/clip-digest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clip_digest-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: clip_digest-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for clip_digest-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 22b4fa543dc2aed14e07ca094ab880cc7e58084dfca537f5fe2b00a16911c57d
MD5 92aeac2a9a5d9dfe163503f328c78f31
BLAKE2b-256 9568eb576cc7c788b58e874205b18e5de86663dbde28d0d8a4f889e82f48a11f

See more details on using hashes here.

Provenance

The following attestation bundles were made for clip_digest-1.0.2-py3-none-any.whl:

Publisher: release.yml on roHIT-MAN-45/clip-digest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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