{"id":18275732,"url":"https://github.com/davideuler/subtitle_merger","last_synced_at":"2025-04-09T04:13:47.972Z","repository":{"id":209179939,"uuid":"723413920","full_name":"davideuler/subtitle_merger","owner":"davideuler","description":"To merge subtitles in two different language into one subtitle file, thus can show subtitles in two languages at the same time","archived":false,"fork":false,"pushed_at":"2023-11-25T15:58:11.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T22:32:29.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/davideuler.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}},"created_at":"2023-11-25T15:38:48.000Z","updated_at":"2024-11-26T03:37:29.000Z","dependencies_parsed_at":"2023-11-25T16:44:11.670Z","dependency_job_id":null,"html_url":"https://github.com/davideuler/subtitle_merger","commit_stats":null,"previous_names":["davideuler/subtitle_merger"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideuler%2Fsubtitle_merger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideuler%2Fsubtitle_merger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideuler%2Fsubtitle_merger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideuler%2Fsubtitle_merger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davideuler","download_url":"https://codeload.github.com/davideuler/subtitle_merger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974731,"owners_count":21026742,"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":[],"created_at":"2024-11-05T12:13:52.416Z","updated_at":"2025-04-09T04:13:47.952Z","avatar_url":"https://github.com/davideuler.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nHow to download a YouTube video with Chinese and English subtitles, and merge both Chinese and English subtitles into the video to create a video with embedded bilingual subtitles.\n\nThe same applies to other languages.\n\n## 1.Download youtube videos with subtitle in multi languages.\n\n```Bash\nyt-dlp --write-subs --write-auto-subs --sub-format SRT --sub-langs \"en,en-orig,zh-Hans\" --write-thumbnail --write-description https://www.youtube.com/xxxxx\n\n# or:\nyt-dlp --write-subs --write-auto-subs --sub-format srt --convert-subs \"srt\" --sub-langs \"en,en-orig,zh-Hans\" --write-thumbnail --write-description \"https://www.youtube.com/watch?v=ZA9K0JMrbWg\"\n\n```\n\n## 2.To merge two subtitle files into one:\n\n```bash\npython merge_subtitle.py \u003csrt_file1\u003e \u003csrt_file2\u003e merged_subtitles.srt\n```\n\nThe output file content is like this:\n```\n    1\n    00:00:00,000 --\u003e 00:00:02,430\n    自计算机开始以来，编码\n    Coding has been the bread and butter for \n    2\n    00:00:02,430 --\u003e 00:00:04,290\n    一直是开发人员的必需品。\n    developers since the dawn of computing. \n\n```\n\n## 3.Then you can merge the subtitle file and origin video file.\nThus you can get a video file with embedded subtitles in two languages.\n\n```\nffmpeg -i input_video.mp4 -vf \"subtitles=merged_subtitles.srt\" -c:a copy output_video.mp4\n```\n\n## Prerequisites\n```Bash\n$ pip install -r requirements.txt\n\n# install ffmpeg on mac:\n$ brew install ffmpeg\n\n# for Ubuntu/Debian, install by apt:\n$ sudo apt-get install ffmpeg\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavideuler%2Fsubtitle_merger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavideuler%2Fsubtitle_merger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavideuler%2Fsubtitle_merger/lists"}