{"id":21625055,"url":"https://github.com/tikene/video-caption-and-translate","last_synced_at":"2025-04-11T12:34:14.924Z","repository":{"id":263997488,"uuid":"875265977","full_name":"tikene/video-caption-and-translate","owner":"tikene","description":"Video URL transcriber and translator using AI. Download from Youtube and translate automatically by adding subtitles to the video","archived":false,"fork":false,"pushed_at":"2024-11-29T22:50:47.000Z","size":56,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T08:51:20.482Z","etag":null,"topics":["ai","captions","chatgpt","downloader","openai","subtitle","subtitles","transcribe","transcriber","translation","translator","url","videos","whisper","youtube"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tikene.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-19T14:26:26.000Z","updated_at":"2025-02-11T06:10:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"576b50c9-bd32-4c54-bc24-72fd7426b700","html_url":"https://github.com/tikene/video-caption-and-translate","commit_stats":null,"previous_names":["tikene/video-caption-and-translate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikene%2Fvideo-caption-and-translate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikene%2Fvideo-caption-and-translate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikene%2Fvideo-caption-and-translate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tikene%2Fvideo-caption-and-translate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tikene","download_url":"https://codeload.github.com/tikene/video-caption-and-translate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248402304,"owners_count":21097328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","captions","chatgpt","downloader","openai","subtitle","subtitles","transcribe","transcriber","translation","translator","url","videos","whisper","youtube"],"created_at":"2024-11-25T01:07:40.620Z","updated_at":"2025-04-11T12:34:14.915Z","avatar_url":"https://github.com/tikene.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Video Transcriber and Translator\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA Python script that automates video subtitle creation \u0026 translation, supporting both local files and online video URLs.\n\n## 🚀 Features\n- Download videos from various platforms easily by specifying the URL (YouTube, Twitter, Facebook, Instagram, etc.)\n- Transcribe audio using ChatGPT's Whisper model (default) or local Whisper model\n- Translate the generated transcriptions to a target language using OpenAI's GPT models\n- Add translated subtitles to videos\n- Support for multiple languages and resolutions (including YouTube Shorts)\n- Support for long videos, these are split into chunks automatically before transcribing and translating\n\n## 🎬 Demo\nHere are some examples of the script in action:\n\n1. **English to Korean Translation**\n\n![American Psycho - Korean](https://github.com/user-attachments/assets/5c76cd45-6221-4ef1-a6bc-367affa5dbe6)\n\n\n2. **English to Spanish Translation**\n\n![Meet the Spy - Spanish](https://github.com/user-attachments/assets/284a9e8d-1fd6-4fbf-bcdb-24a8e284d32f)\n\n\n3. **German to English Translation**\n\n![Adolf Hitler Speech - German](https://github.com/user-attachments/assets/76d67ac5-d5a7-46b2-8a24-addb8dff24af)\n\n\n4. **Spanish to English Translation**\n\n![El hoyo - Spanish](https://github.com/user-attachments/assets/50a33248-83c6-49a7-8d50-42eb735dfe87)\n\n**Note**: Results may vary with accents or background music, especially when using the local model. Video and caption synchronization might be affected when the audio isn't clear. The above clips were processed using OpenAI for both transcription \u0026 translation (default script behavior).\n\n## 🖥️ Usage\nRun the script using the following command:\n```bash\npython translate.py video_input target_language [options]\n```\n\n### Arguments:\n- `video_input`: URL or path to the input video file\n- `target_language`: Target language for translation (e.g., Spanish, English, French)\n\n### Options:\n- `--output_dir`: Directory to save output files (default: \"output\")\n- `--models_path`: Path to store Whisper models (default: \"Models\")\n- `--openai_api_key`: OpenAI API key (if not set as an environment variable)\n- `--font`: Font to use for subtitles (default: \"NanumGothic\")\n- `--use_local_whisper`: Use local Whisper model for transcription instead of ChatGPT's Whisper\n\n## 📋 Examples\n1. Translate YouTube video subtitles to Spanish (using default ChatGPT Whisper):\n   ```bash\n   python translate.py https://www.youtube.com/watch?v=VIDEO_ID Spanish\n   ```\n\n2. Translate local video file subtitles to French (using default ChatGPT Whisper):\n   ```bash\n   python translate.py /path/to/your/video.mp4 French\n   ```\n\n3. Use a specific output directory and font:\n   ```bash\n   python translate.py input_video.mp4 German --output_dir my_output --font Arial\n   ```\n\n4. Use a local model for transcription:\n   ```bash\n   python translate.py input_video.mp4 Korean --use_local_whisper\n   ```\n\n## 🛠️ Installation\n\n### 1. FFmpeg Installation\n\n#### Windows:\n1. Download FFmpeg from [ffmpeg.org](https://ffmpeg.org/download.html)\n2. Extract the ZIP file\n3. Add the `bin` folder path to system PATH\n4. Verify installation: `ffmpeg -version`\n\n#### macOS:\n```bash\nbrew install ffmpeg\n```\n\n#### Linux:\n```bash\nsudo apt update\nsudo apt install ffmpeg\n```\n\n### 2. Python Dependencies\nCreate and activate a virtual environment:\n\n```bash\npython -m venv venv\nsource venv/bin/activate  # Linux/macOS\nvenv\\Scripts\\activate     # Windows\n```\n\nInstall required packages:\n\n```bash\npip install openai==1.12.0\npip install faster-whisper==0.10.0\npip install yt-dlp==2024.3.10\npip install ffmpeg-python==0.2.0\npip install pydub==0.25.1\n```\n\n### 3. OpenAI API Setup\n1. Create account at [platform.openai.com](https://platform.openai.com)\n2. Generate API key in account settings\n3. Set environment variable:\n   ```bash\n   # Linux/macOS\n   export OPENAI_API_KEY='your-key-here'\n   \n   # Windows (PowerShell)\n   $env:OPENAI_API_KEY='your-key-here'\n   ```\n\n### 4. Download the repository\n\n1. Clone repository:\n```bash\ngit clone https://github.com/tikene/video-caption-and-translate.git\ncd video-caption-and-translate\n```\n\n2. Verify installation:\n```bash\npython translate.py --help\n```\n\n## ⏳ Common Issues\n\n### FFmpeg Not Found\n- Ensure FFmpeg is in system PATH\n- Restart terminal/IDE after PATH changes\n- Check with `ffmpeg -version`\n\n### OpenAI API Errors\n- Verify API key is set correctly\n- Check account has sufficient credits\n- Ensure stable internet connection\n\n## 📂 Output\nThe script generates the following files in the output directory:\n1. Downloaded video (if URL was provided)\n2. Translated SRT subtitle file\n3. Video with embedded translated subtitles\n\n## ⚠️ Important Notes\n- The script uses the GPT-4o-mini model for translation by default, which costs around $0.03 cents for a two-minute video. To increase translation quality, you may use gpt-4, but beware that costs will go up substantially\n- Longer video -\u003e Higher costs (duh)\n\n## 📄 License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftikene%2Fvideo-caption-and-translate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftikene%2Fvideo-caption-and-translate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftikene%2Fvideo-caption-and-translate/lists"}