YaoFANGUK / video-subtitle-extractor

视频硬字幕提取,生成srt文件。无需申请第三方API,本地实现文本识别。基于深度学习的视频字幕提取框架,包含字幕区域检测、字幕内容提取。A GUI tool for extracting hard-coded subtitle (hardsub) from videos and generating srt files.
Apache License 2.0
5.62k stars 623 forks source link

Colab 无法运行 #265

Open Marcocxy opened 9 months ago

Marcocxy commented 9 months ago

请输入视频完整路径:/content/10.mp4 请指定字幕区域 (ymin ymax xmin xmax):842 1069 72 1368 识别字幕语言:ch 识别模式:fast 使用GPU进行加速 帧数:34046.0,帧率:23.976215588502367 V4-ch_det_fast V4-ch_rec_fast 【处理中】开启提取视频关键帧... 08:14:33: Logging wxScroll1 08:14:33: Starting program... 08:14:33: CVideoSubFinderApp::OnInitCmdLine... m_VC.isOpened(): 1 path: /content/10.mp4 No such file or directory 08:14:33: ERROR: wrong "re" command line option value 【处理中】开始提取字幕信息,此步骤可能花费较长时间,请耐心等待...

100% 34046/34046 [00:00<00:00, 57673373.98it/s] 【结束】提取视频关键帧完毕... 【结束】完成字幕提取,生成原始字幕文件... 【处理中】开始生成字幕文件 Traceback (most recent call last): File "/content/video-subtitle-extractor/./backend/main.py", line 1010, in se.run() File "/content/video-subtitle-extractor/./backend/main.py", line 182, in run self.generate_subtitle_file_vsf() File "/content/video-subtitle-extractor/./backend/main.py", line 595, in generate_subtitle_file_vsf subs = pysrt.open(self.vsf_subtitle) File "/usr/local/lib/python3.10/dist-packages/pysrt/srtfile.py", line 151, in open source_file, encoding = cls._open_unicode_file(path, claimed_encoding=encoding) File "/usr/local/lib/python3.10/dist-packages/pysrt/srtfile.py", line 292, in _open_unicode_file encoding = claimed_encoding or cls._detect_encoding(path) File "/usr/local/lib/python3.10/dist-packages/pysrt/srtfile.py", line 279, in _detect_encoding file_descriptor = open(path, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/content/video-subtitle-extractor/output/10/subtitle/raw_vsf.srt'

codernew007 commented 9 months ago

俺也一样

YaoFANGUK commented 9 months ago

俺也一样

zzp198 commented 9 months ago

我在本地跑的,也是这样,提取失败。想的是把硬字幕从繁体转化为简体。

选择视频字幕的语言: 繁体中文 选择识别模式: 快速 成功打开视频:C:/Users/Administrator/Desktop/1.mp4 字幕区域:(842,1069,96,1824) 识别字幕语言:chinese_cht 识别模式:fast 使用GPU进行加速 帧数:34729.0,帧率:24.009362699715457 V4-ch_det_fast V3-chinese_cht_rec_fast 【处理中】开启提取视频关键帧... 【处理中】开始提取字幕信息,此步骤可能花费较长时间,请耐心等待... 【结束】提取视频关键帧完毕... 【结束】完成字幕提取,生成原始字幕文件... 【处理中】开始生成字幕文件 Exception in thread Thread-3: Traceback (most recent call last): File "C:\Users\Administrator\Desktop\vse\Python\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\Administrator\Desktop\vse\Python\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "C:\Users\Administrator\Desktop\vse\resources\gui.py", line 316, in task self.se.run() File "C:\Users\Administrator\Desktop\vse\resources\backend\main.py", line 182, in run self.generate_subtitle_file_vsf() File "C:\Users\Administrator\Desktop\vse\resources\backend\main.py", line 595, in generate_subtitle_file_vsf subs = pysrt.open(self.vsf_subtitle) File "C:\Users\Administrator\Desktop\vse\Python\Lib\site-packages\pysrt\srtfile.py", line 151, in open source_file, encoding = cls._open_unicode_file(path, claimed_encoding=encoding) File "C:\Users\Administrator\Desktop\vse\Python\Lib\site-packages\pysrt\srtfile.py", line 292, in _open_unicode_file encoding = claimed_encoding or cls._detect_encoding(path) File "C:\Users\Administrator\Desktop\vse\Python\Lib\site-packages\pysrt\srtfile.py", line 279, in _detect_encoding file_descriptor = open(path, 'rb') FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Administrator\Desktop\vse\resources\output\1\subtitle\raw_vsf.srt'

clementmoine commented 7 months ago

I had the same issue, and solved the problem by copying the video I was interested in Google Drive then importing that to the project.

Locate the Google Drive button in the top left action buttons and click on that to install Google Drive in your project. Then add the following command to your notebook :

!mkdir /content/video-subtitle-extractor/input
!cp /content/drive/MyDrive/video.avi /content/video-subtitle-extractor/input/video.avi

Then you should be good to go, in my example the file was 600x400 file so I entered the following values :

/content/video-subtitle-extractor/input/video.avi
280 398 42 643

Hope it helps !

thhung commented 5 months ago

I still have the same problem after copying videos to the input folder. It seems weirds.