Skip to main content

Tạo phụ đề từ video sử dụng OpenAI Whisper.

Project description

Closed Caption

Closed Caption là một thư viện Python mạnh mẽ, giúp bạn tạo và đồng bộ hóa phụ đề từ video một cách tự động. Thư viện hỗ trợ hai chế độ:

  • Có thời gian: Tự động tạo phụ đề với thời gian đồng bộ từ nội dung âm thanh của video.
  • Không có thời gian: Tạo phụ đề dạng văn bản mà không kèm thời gian.

Tính năng nổi bật

  • Tự động tạo phụ đề từ nội dung âm thanh của video (speech-to-text).

Yêu cầu hệ thống

  • Python >= 3.7
  • FFmpeg (để trích xuất âm thanh từ video)

Cài đặt

  1. Cài đặt thư viện bằng pip:

    pip install closed-caption
    
  2. Cài đặt FFmpeg:

    • Trên Linux (Ubuntu):

      sudo apt update && sudo apt install ffmpeg
      
    • Trên macOS:

      brew install ffmpeg
      
    • Trên Windows:

      • Tải FFmpeg từ ffmpeg.org và thêm vào PATH.

Sử dụng

Tạo phụ đề từ video

1. Tạo phụ đề có thời gian

Tạo file phụ đề .srt với thời gian đồng bộ:

closed_caption video.mp4 output.srt

2. Tạo phụ đề không có thời gian

Tạo file phụ đề .srt không chứa thông tin thời gian:

closed_caption video.mp4 output.srt --no-timing

Sử dụng thư viện trong Python

Tạo phụ đề có thời gian

from closed_caption import create_srt_with_timing

video_path = "video.mp4"
output_srt_path = "output.srt"
create_srt_with_timing(video_path, output_srt_path)

Tạo phụ đề không có thời gian

from closed_caption import create_srt_no_timing

video_path = "video.mp4"
output_srt_path = "output_no_timing.srt"
create_srt_no_timing(video_path, output_srt_path)

Đóng góp

Chúng tôi hoan nghênh mọi đóng góp để cải thiện thư viện. Hãy làm theo các bước sau:

  1. Fork repo này.

  2. Tạo branch mới từ main:

    git checkout -b feature/my-feature
    
  3. Commit thay đổi của bạn:

    git commit -m "Thêm tính năng mới: My Feature"
    
  4. Push branch lên fork của bạn:

    git push origin feature/my-feature
    
  5. Mở Pull Request (PR) và mô tả thay đổi của bạn.

License

Dự án này được phát hành theo giấy phép MIT. Xem chi tiết tại LICENSE.

Liên hệ

Nếu bạn có bất kỳ câu hỏi hoặc góp ý nào, vui lòng liên hệ tại:


Cảm ơn bạn đã sử dụng Closed Caption!

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

closed_caption-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

closed_caption-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file closed_caption-1.0.0.tar.gz.

File metadata

  • Download URL: closed_caption-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for closed_caption-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f21963949cd61ffe4d621db284657bed5f5677834a61623a6efe4de2e8a43ee9
MD5 71743c53fefc8ab832f2f47f011b4ba8
BLAKE2b-256 b5b0bdb5fbeb1e32dbe578b5b6252af1e4d87ae0054fc9924e9cbd70dba7362d

See more details on using hashes here.

File details

Details for the file closed_caption-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: closed_caption-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for closed_caption-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1094345873a5a3033f126b29700d319106d0c1cb7ae64370c827894ea1457bcb
MD5 539812dd81ac4ccc47e3532c226d7629
BLAKE2b-256 40f789cc14160f20541baabb06820784e0dfdf713f732034cfdfe20a62cabb01

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