{%hackmd @debbylin/theme-matcha %} # 皮皮工作筆記 >[name=NC] 僅供網路交流學習 # 字幕軟體 :::success >[name=甜米露][🔗推特討論串](https://x.com/RHEA_tothe_aa/status/1795279124812189712) - [Vrew](#Vrew):可語音轉文字(英日韓西中)準確度在70~80%,但是分斷句功能十分完美,新手友好且上手快👍 - [CapCut](#CapCut):有很多常用語言且是免費無上限的語音轉文字,除了上字幕以外還可以做剪輯,缺點是斷句很怪要自己一個個修 - [Aegisub](#Aegisub):就是專門做字幕的軟體,按秒按幀,要做精細度高的選他沒錯,文件傳輸也快👍缺點就是容易因為各種問題字幕傳輸後錯位/難上手(但熟悉了打得飛快) - [Arctime](#Arctime):非常類似Aegisub的軟體,差別也不算太大🤔比aegisub的頁面簡潔,我個人認為如果實在搞不懂aegisub的可以用這個 - [클로바노트](#Clova-Note) (Clova Note):Naver的專門語音轉文字app(有網頁版)準確度大概在80~90%(因為是以錄音方式轉文字所以容易聽不清楚) - ==[Subtitle edit](#Subtitle-edit)==:目前整體來說最好用的免費開源軟體,還有在定期更新維護,界面和aeigsub很像,但多了很多功能,也可以直接壓片輸出 *** 總結👇 追求精細度:Aegisub/Arctime 追求懶:Vrew/Capcut ::: ## Aegisub * [🔗下載](https://aegisub.org/zh-cn/downloads) * [🔗官方教學](https://aegisub.org/zh-cn/docs/latest/main_page) * [📺教學影片](https://youtu.be/x46-su3l6Gc) `PAPAYA電腦教室` * [🔗進階教學](https://hachibye.medium.com/%E9%97%9C%E6%96%BC%E5%AD%97%E5%B9%95%E7%B5%84%E7%9A%84%E4%BA%8C%E4%B8%89%E4%BA%8B-%E6%89%93%E8%BB%B8%E7%AF%87-d83a3e6a12ce) ### 文本編輯 - 手動翻譯 Subtitle>Translation Assistant ![image](https://hackmd.io/_uploads/Hkj0Fjo40.png =25%x) - 全文取代`ctrl+H` 可選要搜尋的範圍 (limit to 選取的行數) or 取代格式設定 (style/actor/effect) ![image](https://hackmd.io/_uploads/Hy1gssj4A.png =50%x) - 選擇性貼上`ctrl+shift+V` ![](https://hackmd.io/_uploads/ByPaoijEC.png =50%x) ### 打軸快速鍵 * [🔗快速鍵教學](https://forum.gamer.com.tw/C.php?bsn=60608&snA=309) > `G` `Enter`:輸入時間,Enter鍵離很遠不好按,但G鍵在輸入模式會被吃掉 `S` `Num5` `Space`:重複播放所選範圍 `A` `F`:檢視區域往前或往後 `T`:從「起點開始無限往下播放」,我習慣用於確認語境和讓播放Free run 滑鼠左右鍵:選取時間軸,方法影片中有特別教學,可以參考 `D`:播放選取區的最後500毫秒,最適合用來確認結束 - 滑鼠:左/右鍵 = 開始/結束 - 鍵盤:`ctrl+3/4` = 開始/結束 ### 匯出 可匯出 srt 字幕檔 for YT 外掛 File >Export Subtitles... >Export >另存為.srt ## Subtitle edit ==可完美替代Aegisub的開源軟體== (而且我覺得比aegi還好用!!) 支援繁中介面 * [🔗下載](https://github.com/SubtitleEdit/subtitleedit/releases) * [🔗官方教學網頁](https://www.nikse.dk/subtitleedit/help) ### 自動翻譯功能 載入原始語言字幕檔後 Auto-translate >Auto-translate... | 自動翻譯 >自動翻譯 ![image](https://hackmd.io/_uploads/SJVCi6GP1x.png =50%x)![image](https://hackmd.io/_uploads/SJS_xAMP1x.png =45%x) 選擇對應的語言: 左-原本的 / 右-要翻譯的 ![image](https://hackmd.io/_uploads/H1XI2aMDyg.png =80%x) ### 雙語字幕 先打開外語字幕,再載入原文字幕同步編輯 ![image](https://hackmd.io/_uploads/ryyy7_V2le.png =40%x) ![image](https://hackmd.io/_uploads/SJwZNu4hxg.png =60%x) 分別存成 ass 檔可以設定字幕樣式([👉教學](#設定字幕格式)) \*記得要把兩種語言的位置調整到不會重疊 工具>合併字幕 ![image](https://hackmd.io/_uploads/BkDoNuE2el.png =20%x) ![image](https://hackmd.io/_uploads/HyuLHON2el.png =80%x) ### 載入 YouTube 影片 可以直接匯入 youtube 影片,不用下載成 mp4 再匯入 但無法直接壓片匯出 Video >Open video from URL... | 視訊 >從網址開啟影片 ![image](https://hackmd.io/_uploads/ryjEbRMvJx.png =60%x) ![image](https://hackmd.io/_uploads/H1kebRMw1g.png =60%x) 直接貼上要開啟的影片網址 ![image](https://hackmd.io/_uploads/ByuqRpGP1x.png =80%x) 載入的影片會顯示在影片播放器中,可以直接拉軸上字幕 ![image](https://hackmd.io/_uploads/HkK5k0zwJx.png =60%x) ### 設定字幕格式 ==字體設定只有.ass檔案格式可用== 開啟.ass檔之後(或是另存新檔),工具列會出現 **ASSA 樣式** ![image](https://hackmd.io/_uploads/B1xYpSV3xg.png =20%x) ![image](https://hackmd.io/_uploads/ByHTaSV3gl.png =60%x) 設定好想要的樣式之後,直接選取要套用的行,按右鍵>設置樣式>"樣式" ![image](https://hackmd.io/_uploads/H1J4kIE2xl.png =60%x) ASSA工具下面還有一些好用的功能 ![image](https://hackmd.io/_uploads/rkRZxLN3lg.png =60%x) - Set position: 可以直接在影格上點選設定該行字幕的位置(做精字應該很好用) 直接在畫面上點兩下就可以定位,也可以設定字體的立體旋轉 ![image](https://hackmd.io/_uploads/rk5tZ8Ehge.png =60%x) - 產生進度條: 可以做這種跟著時間跑的進度條,每個章節的標題都可以分開設定 ![image](https://hackmd.io/_uploads/B1csl8Nnll.png =60%x) ### 壓制影片字幕 設定好ass的格式之後,視訊>Generate vid with burned-in sub ![image](https://hackmd.io/_uploads/Sk8CZ8Ehgg.png =20%x) 可以選擇壓制 目前開啟的影片+ass 或是 Batch mode 壓制多個影片 ==需要安裝FFmpeg== [👉安裝方法](#ffmpeg) (裝完也可以直接用 command line 壓片) ![image](https://hackmd.io/_uploads/SJUaYB4hle.png =50%x)![image](https://hackmd.io/_uploads/SJxWqS4hee.png =50%x) 更多壓制影片相關可參考 [🔗官方教學](https://www.nikse.dk/subtitleedit/addsubtitlestovideo) ## 小丸工具箱 若使用 aegisub 編輯字幕可以用這個工具把字幕壓在影片上 [🔗下載](https://www.azofreeware.com/p/maruko-toolbox.html) `阿榮福利味` [🔗Github 下載連結](https://github.com/wzxjohn/marukotoolbox) ## Arctime [🔗下載](https://arctime.cn/download.html) [🔗官方教學](https://arctime.cn/keyboard-shortcuts.html) ### 文本編輯 直接在右邊的字幕稿欄位輸入,一行就會成為一塊字幕 或是在其他地方 (ex. 記事本)寫完逐字稿再貼過來也可以 - 翻譯: 語言處理>建立翻譯用副本 >開啟字幕翻譯器 *可以拖曳=常用字詞=到+上,使用`ctrl+num`重複輸入 ![image](https://hackmd.io/_uploads/SJo0CsjN0.png =80%x) ### 打軸快速鍵 快速拖曳建立模式 (快速鍵D) - 滑鼠:直接拖曳時間 - 鍵盤:==播放模式下,`J` `K` 交替長按建立字幕塊== 如果已經有逐字稿,會自動分行建立字塊,沒有的話就會是空白字塊 ### 匯出影片 可直接匯出影片 免費版不支援圖片浮水印,只能用字幕功能壓名字 (另外設定樣式) 可匯出 srt 字幕檔 for YT cc ## CapCut [🔗下載](https://www.capcut.com/zh-tw) [📺教學影片](https://youtu.be/z5hL76aKCKk) `PAPAYA電腦教室` ### 文本編輯 自動辨識語音 (多國語言) 文字>自動字幕>選擇語言 (免費版只能選單語言) ![image](https://hackmd.io/_uploads/B1Tb42j4C.png =50%x) - ==[匯出srt字幕檔](https://www.biyaoyun.com/capcutsrt)== (免費版不支援,可使用此線上工具) 上傳專案資料夾內的 `draft_content.json` 檔案 \>Generate >Save to local (預設專案資料夾會在`C:\Users\[user name]\AppData\Local\CapCut\User Data\Projects\com.lveditor.draft\`,可以在軟體設定中更改到方便取用的位置) ![image](https://hackmd.io/_uploads/BJUTL3sEC.png =30%x) 匯出 srt 後可至其他軟體繼續編輯 ### 快速鍵 - 鍵盤: ### 匯出 - 可加圖片浮水印: 匯入媒體 (支援大部分圖片格式),直接拖曳到時間軸上 可調整在畫面上的位置/水印時間/混和模式>透明度 - 可直接匯出影片 ==!!2024年底更新後每個月免費無浮水印匯出有限制次數== ## Vrew [🔗下載](https://vrew.voyagerx.com/zh-TW) [📺教學影片](https://youtu.be/22vZTxgM3ak) `屏東縣資教中心` [🔗教學](https://harmonica80.blogspot.com/2022/11/vrew.html) - 加圖片水印 插入>圖像>從電腦上傳 (支援png透明底圖) ![image](https://hackmd.io/_uploads/rkFAc2jVC.png =50%x) 拖進時間軸,點選圖片>修改適用範圍>更改為全部片段 ![image](https://hackmd.io/_uploads/SJDsh2oEA.png =30%x) ![image](https://hackmd.io/_uploads/BJD333o40.png =30%x) - 可直接google翻譯字幕成其他語言 - 語音辨識較不準確 ## 擷取硬字幕 ++線上工具++ 用OCR擷取已經壓在影片上的字幕 前兩個網站都是每個帳號有2小時的試用 (請多開google帳號),之後$4.5 USD/10 hr 一般的字體辨識準確度還蠻高的,只需要稍微校稿 第三個免費但不確定能不能用 - https://subtitleextractor.com/ - https://www.subextractor.com/ - https://www.free-srt.com/ ++開源單機版++ ==免費!!!== [VideOCR](https://github.com/timminator/VideOCR) | [🔗下載安裝檔](https://github.com/timminator/VideOCR/releases) 若有 GPU 跑起來還蠻順的,準確率也高 有簡中介面可選,可以框選兩個辨識區域,也可以選擇辨識的語言 (中英日韓) ![image](https://hackmd.io/_uploads/BJnG-t42gx.png =40%x) ## 其他工具 - [🔗下載 YouTube 字幕/逐字稿](https://downsub.com) - [🔗字幕檔翻譯](https://translatesubtitles.co/index.php) (支援多種檔案格式 含srt ass) - [🔗Good Tape](https://goodtape.io) 語音轉文字 (免費版速度較慢 含時間軸&多國語言) - Clova note *** # 影片工具 ## Pytube 下載影片 - 安裝 python: [🔗下載](https://www.python.org/downloads/) - 開啟 powershell: windows 搜尋 'Windows Powershell' ==接下來步驟都在 powershell 黑框框進行== - `pip install pytubefix` - 如果pip無法執行,[看這邊](https://alex9ufoexploer.blogspot.com/2017/10/python-pip.html) - `python` - `from pytubefix import YouTube` ``` url = 'https://www.youtube.com/watch?v=_avjkZu_XTI' yt = YouTube(url, client="WEB") stream = yt.streams.filter(res="1080p").first() stream.download() ``` > url 換成要下載的網址 > res後面的參數可以改成想要的畫質 (720/1080) > 只要下載音源的話 `stream = yt.streams.get_audio_only()` ![image](https://hackmd.io/_uploads/BkKEiN6Ske.png) [](https://forums.lostmediawiki.com/thread/17119/youtube-removed-wayback-machine-limited) 以上如果可以使用,之後可以更簡化直接[在powershell執行單行指令](https://pytubefix.readthedocs.io/en/latest/user/cli.html): `pytubefix URL -r=1080p -a -f` > 會自動下載指定畫質影片和音訊檔 `pytubefix URL -a` > 下載音訊檔 (預設m4a) ## yt-dlp ``` yt-dlp -f best --download-sections "*00:01:00-00:02:00" -o "%(title)s.%(ext)s" "https://www.youtube.com/watch?v=ID" ``` ## ffmpeg > 壓影片+音訊+字幕 安裝 ``` winget install "FFmpeg (Essentials Build)" ``` 跑完後確認安裝成功 ``` ffmpeg -version ``` 合併 mp4/webm + mp3 ``` ffmpeg -i input_video.webm -i input_audio.mp3 -c:v copy -c:a aac output_video.mp4 ``` 合併 mp4 + srt ``` ffmpeg -i input_video.mp4 -vf "subtitles=subtitles.srt" -c:v libx264 -c:a copy sub_output.mp4 ``` 合併 mp4 + ass ``` ffmpeg -i input_video.mp4 -vf "ass=subtitles.ass" -c:v libx264 -c:a copy sub_output.mp4 ``` 合併 webp + mp3 + ass (4K) ``` ffmpeg -i ment5.webm -i ment5.mp3 -vf "subtitles=ment5.ass,scale=3840:2160" -c:v libx264 -crf 18 -preset slow -c:a aac -b:a 192k -movflags +faststart ment5_2160p.mp4 ``` ## Genius 歌詞翻譯 {%preview https://genius.com/Genius-how-to-translate-songs-on-genius-annotated %} #### How To Add Translations Anyone can add a new translation to the site by clicking the "ADD SONG" link at the top of the page. ![image](https://hackmd.io/_uploads/r1QRG5i-ex.png =50%x) #### How To Format Translation Pages Genius prides itself in maintaining standardized translation page formatting. Use this format when adding a translation to Genius. Artist Name: Genius Translations Song Title: Primary Artist - Song Title ("Language Translation" written in Translated Language)' :::warning Artist: Genius Chinese Translations (中文翻譯/中文翻译) Song Title: VANNER - (歌名) (中文翻譯 – Traditional) Tag: 繁體中文翻譯 (Traditional Chinese Translation) ::: ==Leave the following sections blank:== > Featuring > Produced By > Written By > All additional role fields > All song relationship fields > Tags (with the exception of "LANGUAGE TRANSLATION" tag) Feel free to include the following information: > Song Artwork > SoundCloud/YouTube Links > Release Date #### Linking Translations Under “Song Relationships,” click “Add additional song relationship”: - If you’re on the original song page, select “Translations” and add any relevant translations - If you’re on a translation page, select “Translation Of” and add the original page. ![relationship metadata tab open, with several translations of a BLACKPINK song](https://images.genius.com/6700ce0cd6c9f1677e09e4ccb6637364.864x214x1.png =80%x) Links to the pages will then be available in the Translations menu above the lyrics: ![open translations dropdown menu on the original page](https://images.genius.com/e8b7c968f92293695e1729600350a53e.132x322x1.png =20%x) #### Selecting a Language Genius automatically detects a song’s language based on the lyrics which will then be displayed in the Translations menu. If the language is incorrect or wasn’t detected, you can adjust it in the “Tags, Albums & Metadata” section through the “Language” drop-down. Only use this field to adjust the label in the Translations menu. ![open language tab with several language options](https://images.genius.com/0e951608253eb360097a2bfbc159f9da.302x391x1.png =20%x) It’s possible a language may not be included in the list. If you run into this issue, let us know! #### Romanizations Though not a language, we do consider Romanization pages as translations and it is available in the Language drop-down as well. Romanization pages must be listed under the “Genius Romanizations” artist for this to work. # 網路備份工具 ## Youtube stat use [scrapetube](https://github.com/dermasmid/scrapetube) ``` import requests import json import scrapetube channel_url = "YT url" # Replace with actual channel URL output_file = "scraped_videos.txt" API_KEY = "API_token" # get your own token videos = scrapetube.get_channel(channel_url) # Save to a JSON file with UTF-8 encoding def get_exact_upload_date(video_id): """Fetch precise upload timestamp from YouTube Data API.""" url = f"https://www.googleapis.com/youtube/v3/videos?part=snippet&id={video_id}&key={API_KEY}" response = requests.get(url).json() if "items" in response and response["items"]: return response["items"][0]["snippet"]["publishedAt"] # This is in precise ISO 8601 format return "Unknown Date" with open(output_file, "w", encoding="utf-8") as file: for video in videos: title = video["title"]["runs"][0]["text"] if "title" in video and "runs" in video["title"] else "Unknown Title" video_id = video.get("videoId", "Unknown ID") url = f"https://www.youtube.com/watch?v={video_id}" upload_date = get_exact_upload_date(video_id) views = video.get("viewCountText", {}).get("simpleText", "Unknown Views") duration = video.get("lengthText", {}).get("simpleText", "Unknown Length") file.write(f"Title: {title}\nVideo ID: {video_id}\nURL: {url}\nUpload Date: {upload_date}\nViews: {views}\nDuration: {duration}\n\n") print(f"Scraped data saved to {output_file}") ``` ## 網頁備份 ### WebArchive > for 公開頁面 ex. 新聞網頁、部落格 > SNS 網站通常無法使用 網頁版:https://web.archive.org/save | [chrome 外掛](https://chromewebstore.google.com/detail/wayback-machine/fpnmgdkabkmnadcjpehmlllkndpkmiak): 點 Save Page Now 就等他跑![image](https://hackmd.io/_uploads/SydjVL4hxe.png =25x) -> ![image](https://hackmd.io/_uploads/H1ozHU43xl.png =25x) 跑完如果有登入設定會自己加到帳號的收藏裡 ![image](https://hackmd.io/_uploads/HksZ0X72el.png =30%x) ### Single File > for 需要登入的 ex. 官咖 > 下載單一網頁 html 檔 https://www.getsinglefile.com/ | [Chrome 外掛](https://chromewebstore.google.com/detail/singlefile/mpiodijhokgodhhofbcjdecpffjipkle) ![image](https://hackmd.io/_uploads/r1pvJEQngg.png =70%x) 1. Save page with SingleFile: 儲存目前分頁 2. Save tabs: 儲存目前視窗中的所有分頁 3. Auto-save: 自動儲存所有打開的新分頁 > 可以把不要存的分頁釘選(pin), 然後使用Auto-save unpinned tabs - ++option++ - User Interface - [x] auto-close the tab after the page is saved 自動關掉儲存好的分頁 - File name >Template: ``` {url-last-segment}-%if-empty<{page-title}|Untitled>.{filename-extension} ``` ## 批次處理網頁 ### 批次開啟分頁 > 以官咖文章為例,網頁照號碼編排 > **可能會吃很多資源,請斟酌使用** Chrome >F12 >Console (把這頁pin起來) ``` const base = "https://url/"; for (let i = 1; i <= 10; i++) { window.open(base + i, '_blank'); } ``` 修改參數可以批次打開分頁,搭配 singlefile 使用 ==啟用 Auto-save unpinned + auto-close the tab after the page is saved== 自動存完會關掉,再開下一批頁面。處理完記得把auto-save關掉!! 或是開啟特定頁面, ###替換為網址內容 ``` const links = [###]; const base = "https://url/"; links.forEach(num => window.open(base + num, '_blank')); ``` ### 批次下載檔案 > .bat 下載檔案 ``` curl -O url ``` 下載多個按規則命名的檔案 + 存至各別子資料夾 ``` mkdir "folder" cd "folder" for %%i in (1 2 3 4 5 6 7 8 9 10) do ( curl -O https://url/%%i.jpg ) cd.. ``` 資料夾中所有圖片轉檔 webp>>png (也可以轉成jpg) ``` @echo off for %%F in (*.webp) do ffmpeg -i "%%F" "%%~nF.png" ``` ### 批次擷取網頁內容 分析 html 內容並另存成表格 >.py ``` import os import re import csv # Define the date pattern used in Daum Cafe posts (e.g., 19.10.26 01:24) date_pattern = re.compile(r'\b\d{2}\.\d{2}\.\d{2} \d{2}:\d{2}\b') # Prepare the output CSV file with open('post_dates.csv', 'w', newline='', encoding='utf-8') as csvfile: writer = csv.writer(csvfile) writer.writerow(['Filename', 'Post Date']) # Iterate over all HTML files in the current directory for filename in os.listdir('.'): if filename.lower().endswith('.html'): try: with open(filename, 'r', encoding='utf-8') as f: content = f.read() match = date_pattern.search(content) post_date = match.group(0) if match else 'Not Found' writer.writerow([filename, post_date]) except Exception as e: writer.writerow([filename, f'Error: {str(e)}']) ```