{"id":15136581,"url":"https://github.com/ieasybooks/tafrigh","last_synced_at":"2026-02-06T23:06:10.299Z","repository":{"id":150933346,"uuid":"616515963","full_name":"ieasybooks/tafrigh","owner":"ieasybooks","description":"تفريغ النصوص وإنشاء ملفات SRT و VTT باستخدام نماذج Whisper وتقنية wit.ai.","archived":false,"fork":false,"pushed_at":"2025-04-02T14:23:40.000Z","size":646,"stargazers_count":135,"open_issues_count":6,"forks_count":18,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-07T19:55:19.576Z","etag":null,"topics":["asr","automatic-speech-recognition","ctranslate2","facebook","faster-whisper","javascript","python","soundcloud","srt","stable-whisper","subtitles","twitter","vtt","whisper","youtube"],"latest_commit_sha":null,"homepage":"https://tafrigh.ieasybooks.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ieasybooks.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-03-20T14:38:37.000Z","updated_at":"2025-07-17T17:00:03.000Z","dependencies_parsed_at":"2023-12-11T13:29:13.498Z","dependency_job_id":"87d6e545-1116-42db-8f4c-9ff631eecad4","html_url":"https://github.com/ieasybooks/tafrigh","commit_stats":{"total_commits":197,"total_committers":4,"mean_commits":49.25,"dds":"0.20304568527918787","last_synced_commit":"963d22bc1e8e2172c627dbd32f57e46828d8f758"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/ieasybooks/tafrigh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieasybooks%2Ftafrigh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieasybooks%2Ftafrigh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieasybooks%2Ftafrigh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieasybooks%2Ftafrigh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ieasybooks","download_url":"https://codeload.github.com/ieasybooks/tafrigh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ieasybooks%2Ftafrigh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29179598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T22:12:24.066Z","status":"ssl_error","status_checked_at":"2026-02-06T22:12:09.859Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["asr","automatic-speech-recognition","ctranslate2","facebook","faster-whisper","javascript","python","soundcloud","srt","stable-whisper","subtitles","twitter","vtt","whisper","youtube"],"created_at":"2024-09-26T06:23:26.704Z","updated_at":"2026-02-06T23:06:10.276Z","avatar_url":"https://github.com/ieasybooks.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/7662492/229289746-89c5a4c7-afa6-4d46-a0e6-63dfdeb98285.jpg\" style=\"width: 100%;\"/\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://pypi.org/project/tafrigh\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/tafrigh?label=PyPI%20Version\u0026color=limegreen\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.org/project/tafrigh\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/pypi/pyversions/tafrigh?color=limegreen\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/ieasybooks/tafrigh/blob/main/LICENSE\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/pypi/l/tafrigh?color=limegreen\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://pepy.tech/project/tafrigh\" target=\"_blank\"\u003e\u003cimg src=\"https://static.pepy.tech/badge/tafrigh\" /\u003e\u003c/a\u003e\n\n  \u003ca href=\"https://github.com/ieasybooks/tafrigh/actions/workflows/formatter.yml\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/ieasybooks/tafrigh/actions/workflows/formatter.yml/badge.svg\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://sonarcloud.io/summary/new_code?id=ieasybooks_tafrigh\" target=\"_blank\"\u003e\u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=ieasybooks_tafrigh\u0026metric=code_smells\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://tafrigh.ieasybooks.com\" target=\"_blank\"\u003e\u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  [![ar](https://img.shields.io/badge/lang-ar-brightgreen.svg)](README.md)\n  [![en](https://img.shields.io/badge/lang-en-red.svg)](README.en.md)\n\n\u003c/div\u003e\n\n\u003ch1\u003eTafrigh\u003c/h1\u003e\n\n\u003cp\u003eA tool to transcribe visual or audio materials into text. You can view examples transcribed using Tafrigh from \u003ca href=\"https://drive.google.com/drive/folders/1mwdJ9t4tiu8jFGosvNsq8SL54HoQMB8G?usp=sharing\"\u003ehere\u003c/a\u003e or from \u003ca href=\"https://baheth.ieasybooks.com\"\u003eBaheth\u003c/a\u003e platform, all the transcribed content on it is transcribed using Tafrigh.\u003c/p\u003e\n\n\u003cp\u003e\u003cem\u003eNote: If you want to use Tafrigh through JavaScript, take a look at \u003ca href=\"https://github.com/ragaeeb/tafrigh\"\u003ethis\u003c/a\u003e repository.\u003c/em\u003e\u003c/p\u003e\n\n\u003ch2\u003eFeatures of Tafrigh\u003c/h2\u003e\n\n\u003cul\u003e\n  \u003cli\u003eTranscribing visual and audio materials into text using the latest AI technologies provided by OpenAI\u003c/li\u003e\n  \u003cli\u003eAbility to transcribe materials using wit.ai technologies provided by Facebook\u003c/li\u003e\n  \u003cli\u003eDownload materials directly from YouTube, Facebook, Twitter, SoundCloud, and \u003ca href=\"https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md\"\u003eother sites\u003c/a\u003e\u003c/li\u003e\n  \u003cli\u003eDownload visual content directly from YouTube, whether a single video or a complete playlist\u003c/li\u003e\n  \u003cli\u003eProvide various output formats like \u003ccode\u003etxt\u003c/code\u003e, \u003ccode\u003esrt\u003c/code\u003e, \u003ccode\u003evtt\u003c/code\u003e, \u003ccode\u003ecsv\u003c/code\u003e, \u003ccode\u003etsv\u003c/code\u003e, and \u003ccode\u003ejson\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch2\u003eRequirements\u003c/h2\u003e\n\n\u003cul\u003e\n  \u003cli\u003eA strong GPU in your computer is recommended if using Whisper models\u003c/li\u003e\n  \u003cli\u003ePython version 3.10 or higher installed on your computer\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"https://ffmpeg.org\"\u003eFFmpeg\u003c/a\u003e installed on your computer\u003c/li\u003e\n  \u003cli\u003e\u003ca href=\"https://github.com/yt-dlp/yt-dlp\"\u003eyt-dlp\u003c/a\u003e installed on your computer\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch2\u003eInstalling Tafrigh\u003c/h2\u003e\n\n\u003ch3\u003eUsing \u003ccode\u003epip\u003c/code\u003e\u003c/h3\u003e\n\n\u003cp\u003eYou can install Tafrigh using \u003ccode\u003epip\u003c/code\u003e with the command: \u003ccode\u003epip install tafrigh[wit,whisper]\u003c/code\u003e\u003c/p\u003e\n\n\u003cp\u003eYou can specify the dependencies you want to install based on the technology you want to use by writing \u003ccode\u003ewit\u003c/code\u003e or \u003ccode\u003ewhisper\u003c/code\u003e in square brackets as shown in the previous command.\u003c/p\u003e\n\n\u003ch3\u003eFrom the Source Code\u003c/h3\u003e\n\n\u003cul\u003e\n  \u003cli\u003eDownload this repository by clicking on Code then Download ZIP or by executing the following command: \u003ccode\u003egit clone git@github.com:ieasybooks/tafrigh.git\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003eExtract the file if downloaded as ZIP and navigate to the project folder\u003c/li\u003e\n  \u003cli\u003eExecute the following command to install Tafrigh: \u003ccode\u003epoetry install\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eAdd \u003ccode\u003e-E wit\u003c/code\u003e or \u003ccode\u003e-E whisper\u003c/code\u003e to specify the dependencies to install.\u003c/p\u003e\n\n\u003ch2\u003eUsing Tafrigh\u003c/h2\u003e\n\n\u003ch3\u003eAvailable Options\u003c/h3\u003e\n\n\u003cul\u003e\n  \u003cli\u003e\n    Inputs\n    \u003cul\u003e\n      \u003cli\u003eLinks or file paths: Pass the links or file paths of the materials to be transcribed directly after the Tafrigh tool name. For example: \u003ccode\u003etafrigh \"https://yout...\" \"https://yout...\" \"C:\\Users\\ieasybooks\\leactue.wav\"\u003c/code\u003e\u003c/li\u003e\n      \u003cli\u003eSkip transcription if output exists: Use the \u003ccode\u003e--skip_if_output_exist\u003c/code\u003e option to skip transcription if the required outputs already exist in the specified output folder\u003c/li\u003e\n      \u003cli\u003eNumber of download retries: If downloading a full playlist using the \u003ccode\u003eyt-dlp\u003c/code\u003e library, some items may fail to download. The \u003ccode\u003e--download_retries\u003c/code\u003e option can be used to specify the number of retry attempts if a download fails. The default value is \u003ccode\u003e3\u003c/code\u003e\u003c/li\u003e\n      \u003cli\u003eAdditional options for \u003ccode\u003eyt-dlp\u003c/code\u003e: You can pass additional options to the \u003ccode\u003eyt-dlp\u003c/code\u003e library using the \u003ccode\u003e--yt_dlp_options\u003c/code\u003e option in valid JSON format. For example, to download only the first 10 items from a playlist, pass \u003ccode\u003e--yt_dlp_options '{\"playlist_items\": \"1-10\"}'\u003c/code\u003e\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/li\u003e\n\n  \u003cli\u003e\n    Whisper Options\n    \u003cul\u003e\n      \u003cli\u003e\n        Model: You can specify the model using the \u003ccode\u003e--model_name_or_path\u003c/code\u003e option. Available models:\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003etiny.en\u003c/code\u003e (English only)\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003etiny\u003c/code\u003e (least accurate)\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003ebase.en\u003c/code\u003e (English only)\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003ebase\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003esmall.en\u003c/code\u003e (English only)\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003esmall\u003c/code\u003e \u003cstrong\u003e(default)\u003c/strong\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003emedium.en\u003c/code\u003e (English only)\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003emedium\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003elarge-v1\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003elarge-v2\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003elarge-v3\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003elarge\u003c/code\u003e (most accurate)\u003c/li\u003e\n          \u003cli\u003eWhisper model name on HuggingFace Hub\u003c/li\u003e\n          \u003cli\u003ePath to a pre-downloaded Whisper model\u003c/li\u003e\n          \u003cli\u003ePath to a Whisper model converted using the \u003ca href=\"https://opennmt.net/CTranslate2/guides/transformers.html\"\u003e\u003ccode\u003ect2-transformers-converter\u003c/code\u003e\u003c/a\u003e tool for use with the fast library \u003ca href=\"https://github.com/guillaumekln/faster-whisper\"\u003e\u003ccode\u003efaster-whisper\u003c/code\u003e\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\n        Task: You can specify the task using the \u003ccode\u003e--task\u003c/code\u003e option. Available tasks:\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003etranscribe\u003c/code\u003e: Convert speech to text \u003cstrong\u003e(default)\u003c/strong\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003etranslate\u003c/code\u003e: Translate speech to text in English\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n      \u003cli\u003eLanguage: You can specify the audio language using the \u003ccode\u003e--language\u003c/code\u003e option. For example, to specify Arabic, pass \u003ccode\u003ear\u003c/code\u003e. If not specified, the language will be detected automatically\u003c/li\u003e\n      \u003cli\u003eUse faster version of Whisper models: By passing the \u003ccode\u003e--use_faster_whisper\u003c/code\u003e option, the faster version of Whisper models will be used\u003c/li\u003e\n      \u003cli\u003eBeam size: You can improve results using the \u003ccode\u003e--beam_size\u003c/code\u003e option, which allows the model to search a wider range of words during text generation. The default value is \u003ccode\u003e5\u003c/code\u003e\u003c/li\u003e\n      \u003cli\u003e\n        Model compression type: You can specify the compression method used during the model conversion using the \u003ccode\u003ect2-transformers-converter\u003c/code\u003e tool by passing the \u003ccode\u003e--ct2_compute_type\u003c/code\u003e option. Available methods:\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003edefault\u003c/code\u003e \u003cstrong\u003e(default)\u003c/strong\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003eint8\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003eint8_float16\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003eint16\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003efloat16\u003c/code\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/li\u003e\n\n  \u003cli\u003e\n    Wit Options\n    \u003cul\u003e\n      \u003cli\u003eWit.ai keys: You can use \u003ca href=\"wit.ai\"\u003ewit.ai\u003c/a\u003e technologies to transcribe materials into text by passing your wit.ai client access tokens to the \u003ccode\u003e--wit_client_access_tokens\u003c/code\u003e option. If this option is passed, wit.ai will be used for transcription. Otherwise, Whisper models will be used\u003c/li\u003e\n      \u003cli\u003eMaximum cutting duration: You can specify the maximum cutting duration, which will affect the length of sentences in SRT and VTT files, by passing the \u003ccode\u003e--max_cutting_duration\u003c/code\u003e option. The default value is \u003ccode\u003e15\u003c/code\u003e\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/li\u003e\n\n  \u003cli\u003e\n    Outputs\n    \u003cul\u003e\n      \u003cli\u003eMerge segments: You can use the \u003ccode\u003e--min_words_per_segment\u003c/code\u003e option to control the minimum number of words that can be in a single transcription segment. The default value is \u003ccode\u003e1\u003c/code\u003e. Pass \u003ccode\u003e0\u003c/code\u003e to disable this feature\u003c/li\u003e\n      \u003cli\u003eSave original files before merging: Use the \u003ccode\u003e--save_files_before_compact\u003c/code\u003e option to save the original files before merging segments based on the \u003ccode\u003e--min_words_per_segment\u003c/code\u003e option\u003c/li\u003e\n      \u003cli\u003eSave yt-dlp library responses: You can save the yt-dlp library responses in JSON format by passing the \u003ccode\u003e--save_yt_dlp_responses\u003c/code\u003e option\u003c/li\u003e\n      \u003cli\u003eOutput sample segments: You can pass a value to the \u003ccode\u003e--output_sample\u003c/code\u003e option to get a random sample of all transcribed segments from each material after merging based on the \u003ccode\u003e--min_words_per_segment\u003c/code\u003e option. The default value is \u003ccode\u003e0\u003c/code\u003e, meaning no samples will be output\u003c/li\u003e\n      \u003cli\u003e\n        Output formats: You can specify the output formats using the \u003ccode\u003e--output_formats\u003c/code\u003e option. Available formats:\n        \u003cul\u003e\n          \u003cli\u003e\u003ccode\u003etxt\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003esrt\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003evtt\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003ecsv\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003etsv\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003ejson\u003c/code\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003eall\u003c/code\u003e \u003cstrong\u003e(default)\u003c/strong\u003e\u003c/li\u003e\n          \u003cli\u003e\u003ccode\u003enone\u003c/code\u003e (No file will be created if this format is passed)\u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/li\u003e\n      \u003cli\u003eOutput folder: You can specify the output folder using the \u003ccode\u003e--output_dir\u003c/code\u003e option. By default, the current folder will be the output folder if not specified\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/li\u003e\n\u003c/ul\u003e\n\n```\n➜ tafrigh --help\nusage: tafrigh [-h] [--version] [--skip_if_output_exist | --no-skip_if_output_exist] [--download_retries DOWNLOAD_RETRIES] [--yt_dlp_options YT_DLP_OPTIONS] [--verbose | --no-verbose] [-m MODEL_NAME_OR_PATH] [-t {transcribe,translate}]\n               [-l {af,am,ar,as,az,ba,be,bg,bn,bo,br,bs,ca,cs,cy,da,de,el,en,es,et,eu,fa,fi,fo,fr,gl,gu,ha,haw,he,hi,hr,ht,hu,hy,id,is,it,ja,jw,ka,kk,km,kn,ko,la,lb,ln,lo,lt,lv,mg,mi,mk,ml,mn,mr,ms,mt,my,ne,nl,nn,no,oc,pa,pl,ps,pt,ro,ru,sa,sd,si,sk,sl,sn,so,sq,sr,su,sv,sw,ta,te,tg,th,tk,tl,tr,tt,uk,ur,uz,vi,yi,yo,zh}]\n               [--use_faster_whisper | --no-use_faster_whisper] [--beam_size BEAM_SIZE] [--ct2_compute_type {default,int8,int8_float16,int16,float16}] [-w WIT_CLIENT_ACCESS_TOKENS [WIT_CLIENT_ACCESS_TOKENS ...]] [--max_cutting_duration [1-17]]\n               [--min_words_per_segment MIN_WORDS_PER_SEGMENT] [--save_files_before_compact | --no-save_files_before_compact] [--save_yt_dlp_responses | --no-save_yt_dlp_responses] [--output_sample OUTPUT_SAMPLE]\n               [-f {all,txt,srt,vtt,csv,tsv,json,none} [{all,txt,srt,vtt,csv,tsv,json,none} ...]] [-o OUTPUT_DIR]\n               urls_or_paths [urls_or_paths ...]\n\noptions:\n  -h, --help            show this help message and exit\n  --version             show program's version number and exit\n\nInput:\n  urls_or_paths         Video/Playlist URLs or local folder/file(s) to transcribe.\n  --skip_if_output_exist, --no-skip_if_output_exist\n                        Whether to skip generating the output if the output file already exists.\n  --download_retries DOWNLOAD_RETRIES\n                        Number of retries for yt-dlp downloads that fail.\n  --yt_dlp_options YT_DLP_OPTIONS\n                        Additional options to pass to yt-dlp in valid JSON format (e.g. `'{\"playlist_items\": \"1-10\"}'`).\n  --verbose, --no-verbose\n                        Whether to print out the progress and debug messages.\n\nWhisper:\n  -m MODEL_NAME_OR_PATH, --model_name_or_path MODEL_NAME_OR_PATH\n                        Name or path of the Whisper model to use.\n  -t {transcribe,translate}, --task {transcribe,translate}\n                        Whether to perform X-\u003eX speech recognition ('transcribe') or X-\u003eEnglish translation ('translate').\n  -l {af,am,ar,as,az,ba,be,bg,bn,bo,br,bs,ca,cs,cy,da,de,el,en,es,et,eu,fa,fi,fo,fr,gl,gu,ha,haw,he,hi,hr,ht,hu,hy,id,is,it,ja,jw,ka,kk,km,kn,ko,la,lb,ln,lo,lt,lv,mg,mi,mk,ml,mn,mr,ms,mt,my,ne,nl,nn,no,oc,pa,pl,ps,pt,ro,ru,sa,sd,si,sk,sl,sn,so,sq,sr,su,sv,sw,ta,te,tg,th,tk,tl,tr,tt,uk,ur,uz,vi,yi,yo,zh}, --language {af,am,ar,as,az,ba,be,bg,bn,bo,br,bs,ca,cs,cy,da,de,el,en,es,et,eu,fa,fi,fo,fr,gl,gu,ha,haw,he,hi,hr,ht,hu,hy,id,is,it,ja,jw,ka,kk,km,kn,ko,la,lb,ln,lo,lt,lv,mg,mi,mk,ml,mn,mr,ms,mt,my,ne,nl,nn,no,oc,pa,pl,ps,pt,ro,ru,sa,sd,si,sk,sl,sn,so,sq,sr,su,sv,sw,ta,te,tg,th,tk,tl,tr,tt,uk,ur,uz,vi,yi,yo,zh}\n                        Language spoken in the audio, skip to perform language detection.\n  --use_faster_whisper, --no-use_faster_whisper\n                        Whether to use Faster Whisper implementation.\n  --beam_size BEAM_SIZE\n                        Number of beams in beam search, only applicable when temperature is zero.\n  --ct2_compute_type {default,int8,int8_float16,int16,float16}\n                        Quantization type applied while converting the model to CTranslate2 format.\n\nWit:\n  -w WIT_CLIENT_ACCESS_TOKENS [WIT_CLIENT_ACCESS_TOKENS ...], --wit_client_access_tokens WIT_CLIENT_ACCESS_TOKENS [WIT_CLIENT_ACCESS_TOKENS ...]\n                        List of wit.ai client access tokens. If provided, wit.ai APIs will be used to do the transcription, otherwise whisper will be used.\n  --max_cutting_duration [1-17]\n                        The maximum allowed cutting duration. It should be between 1 and 17.\n\nOutput:\n  --min_words_per_segment MIN_WORDS_PER_SEGMENT\n                        The minimum number of words should appear in each transcript segment. Any segment have words count less than this threshold will be merged with the next one. Pass 0 to disable this behavior.\n  --save_files_before_compact, --no-save_files_before_compact\n                        Saves the output files before applying the compact logic that is based on --min_words_per_segment.\n  --save_yt_dlp_responses, --no-save_yt_dlp_responses\n                        Whether to save the yt-dlp library JSON responses or not.\n  --output_sample OUTPUT_SAMPLE\n                        Samples random compacted segments from the output and generates a CSV file contains the sampled data. Pass 0 to disable this behavior.\n  -f {all,txt,srt,vtt,csv,tsv,json,none} [{all,txt,srt,vtt,csv,tsv,json,none} ...], --output_formats {all,txt,srt,vtt,csv,tsv,json,none} [{all,txt,srt,vtt,csv,tsv,json,none} ...]\n                        Format of the output file; if not specified, all available formats will be produced.\n  -o OUTPUT_DIR, --output_dir OUTPUT_DIR\n                        Directory to save the outputs.\n```\n\n\u003ch3\u003eTranscription from command line\u003c/h3\u003e\n\n\u003ch4\u003eTranscribing using Whisper models\u003c/h4\u003e\n\n\u003ch5\u003eTranscribing a single material\u003c/h5\u003e\n\n```bash\ntafrigh \"https://youtu.be/dDzxYcEJbgo\" \\\n  --model_name_or_path small \\\n  --task transcribe \\\n  --language ar \\\n  --output_dir . \\\n  --output_formats txt srt\n```\n\n\u003ch5\u003eTranscribing a full playlist\u003c/h5\u003e\n\n```bash\ntafrigh \"https://youtube.com/playlist?list=PLyS-PHSxRDxsLnVsPrIwnsHMO5KgLz7T5\" \\\n  --model_name_or_path small \\\n  --task transcribe \\\n  --language ar \\\n  --output_dir . \\\n  --output_formats txt srt\n```\n\n\u003ch5\u003eTranscribing multiple materials\u003c/h5\u003e\n\n```bash\ntafrigh \"https://youtu.be/4h5P7jXvW98\" \"https://youtu.be/jpfndVSROpw\" \\\n  --model_name_or_path small \\\n  --task transcribe \\\n  --language ar \\\n  --output_dir . \\\n  --output_formats txt srt\n```\n\n\u003ch5\u003eSpeeding up the transcription process\u003c/h5\u003e\n\n\u003cp\u003eYou can use the \u003ccode\u003e\u003ca href=\"https://github.com/guillaumekln/faster-whisper\"\u003efaster_whisper\u003c/a\u003e\u003c/code\u003e library, which provides faster transcription, by passing the \u003ccode\u003e--use_faster_whisper\u003c/code\u003e option as follows:\u003c/p\u003e\n\n```bash\ntafrigh \"https://youtu.be/3K5Jh_-UYeA\" \\\n  --model_name_or_path large \\\n  --task transcribe \\\n  --language ar \\\n  --use_faster_whisper \\\n  --output_dir . \\\n  --output_formats txt srt\n```\n\n\u003ch4\u003eTranscribing using wit.ai technology\u003c/h4\u003e\n\n\u003ch5\u003eTranscribing a single material\u003c/h5\u003e\n\n```bash\ntafrigh \"https://youtu.be/dDzxYcEJbgo\" \\\n  --wit_client_access_tokens XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \\\n  --output_dir . \\\n  --output_formats txt srt \\\n  --min_words_per_segment 10 \\\n  --max_cutting_duration 10\n```\n\n\u003ch5\u003eTranscribing a full playlist\u003c/h5\u003e\n\n```bash\ntafrigh \"https://youtube.com/playlist?list=PLyS-PHSxRDxsLnVsPrIwnsHMO5KgLz7T5\" \\\n  --wit_client_access_tokens XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \\\n  --output_dir . \\\n  --output_formats txt srt \\\n  --min_words_per_segment 10 \\\n  --max_cutting_duration 10\n```\n\n\u003ch5\u003eTranscribing multiple materials\u003c/h5\u003e\n\n```bash\ntafrigh \"https://youtu.be/4h5P7jXvW98\" \"https://youtu.be/jpfndVSROpw\" \\\n  --wit_client_access_tokens XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \\\n  --output_dir . \\\n  --output_formats txt srt \\\n  --min_words_per_segment 10 \\\n  --max_cutting_duration 10\n```\n\n\u003ch3\u003eTranscribing using code\u003c/h3\u003e\n\n\u003cp\u003eYou can use Tafrigh through code as follows:\u003c/p\u003e\n\n```python\nfrom tafrigh import farrigh, Config\n\nif __name__ == '__main__':\n  config = Config(\n    input=Config.Input(\n      urls_or_paths=['https://youtu.be/qFsUwp5iomU'],\n      skip_if_output_exist=False,\n      download_retries=3,\n      yt_dlp_options='{}',\n      verbose=False,\n    ),\n    whisper=Config.Whisper(\n      model_name_or_path='tiny',\n      task='transcribe',\n      language='ar',\n      use_faster_whisper=True,\n      beam_size=5,\n      ct2_compute_type='default',\n    ),\n    wit=Config.Wit(\n      wit_client_access_tokens=[],\n      max_cutting_duration=10,\n    ),\n    output=Config.Output(\n      min_words_per_segment=10,\n      save_files_before_compact=False,\n      save_yt_dlp_responses=False,\n      output_sample=0,\n      output_formats=['txt', 'srt'],\n      output_dir='.',\n    ),\n  )\n\n  for progress in farrigh(config):\n    print(progress)\n```\n\n\u003cp\u003eThe \u003ccode\u003efarrigh\u003c/code\u003e function is a generator that produces the current transcription state and the progress of the process. If you do not need to track this, you can skip the loop by using \u003ccode\u003edeque\u003c/code\u003e as follows:\u003c/p\u003e\n\n```python\nfrom collections import deque\n\nfrom tafrigh import farrigh, Config\n\nif __name__ == '__main__':\n  config = Config(...)\n\n  deque(farrigh(config), maxlen=0)\n```\n\n\u003ch3\u003eTranscribing using Docker\u003c/h3\u003e\n\n\u003cp\u003eIf you have Docker on your computer, the easiest way to use Tafrigh is through Docker. The following command downloads the Tafrigh Docker image and transcribes a YouTube material using wit.ai technologies, outputting the results in the current folder:\u003c/p\u003e\n\n```bash\ndocker run -it --rm -v \"$PWD:/tafrigh\" ghcr.io/ieasybooks/tafrigh \\\n  \"https://www.youtube.com/watch?v=qFsUwp5iomU\" \\\n  --wit_client_access_tokens XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \\\n  -f txt srt\n```\n\n\u003cp\u003eYou can pass any option from the Tafrigh library options mentioned above.\u003c/p\u003e\n\n\u003cp\u003eThere are multiple Docker images you can use for Tafrigh based on the dependencies you want to use:\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003ccode\u003eghcr.io/ieasybooks/tafrigh\u003c/code\u003e: Contains dependencies for both wit.ai technologies and Whisper models\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003eghcr.io/ieasybooks/tafrigh-whisper\u003c/code\u003e: Contains dependencies for Whisper models only\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003eghcr.io/ieasybooks/tafrigh-wit\u003c/code\u003e: Contains dependencies for wit.ai technologies only\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eOne drawback is that Whisper models cannot use your computer's GPU when used through Docker, which is something we are working on resolving in the future.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003cp\u003eA significant part of this project is based on the \u003ca href=\"https://github.com/m1guelpf/yt-whisper\"\u003eyt-whisper\u003c/a\u003e repository to achieve Tafrigh faster.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fieasybooks%2Ftafrigh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fieasybooks%2Ftafrigh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fieasybooks%2Ftafrigh/lists"}