Closed samcwk closed 3 years ago
btw, I have tried another commands but more or less the same result, such as:
autosub -i test.mp4 -S zh-CN -D zh-CN
Translating text from "None" to "None".
Translation: N/A% | | ETA: --:--:--Traceback (most recent call last):
File "/Users/sam/.pyenv/versions/3.8.2/bin/autosub", line 8, in
autosub -i test.mp4 -S zh-CN -D zh-CN -o . -bm all
Translating text from "None" to "None".
Translation: N/A% | | ETA: --:--:--Traceback (most recent call last):
File "/Users/sam/.pyenv/versions/3.8.2/bin/autosub", line 8, in
autosub -i test.mp4 -S zh-CN -D zh-CN -o test.srt -bm all
Traceback (most recent call last):
File "/Users/sam/.pyenv/versions/3.8.2/bin/autosub", line 8, in
Please try to use -SRC to specify the translation source language,googletrans 4.0.0 does not seem to support automatic language recognition anymore. #158
Please try to use -SRC to specify the translation source language,googletrans 4.0.0 does not seem to support automatic language recognition anymore. #158
Thanks for reply. But it's not working.
autosub -i test.mp4 -S zh-CN -SRC zh-CN -D zh-CN -o ./test.srt -bm all `Let speech lang code to match Google Speech-to-Text lang codes. Now match lang codes. Input: zh-cn Score above: 90 Match result Score (0-100) cmn-hans-cn 100 cmn-hans-hk 96 Use "cmn-hans-cn" instead. Use langcodes to standardize the result. Use "cmn-Hans-CN" instead. Speech language is the same as the destination language. Only performing speech recognition.
Convert source file to "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" to detect audio regions. /usr/local/bin/ffmpeg -hide_banner -y -i "test.mp4" -vn -ac 1 -ar 48000 -loglevel error "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav"
Use ffprobe to check conversion result. /usr/local/bin/ffprobe "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" -show_format -pretty -loglevel quiet [FORMAT] filename=/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav nb_streams=1 nb_programs=0 format_name=wav format_long_name=WAV / WAVE (Waveform Audio) start_time=N/A duration=0:01:30.650708 size=8.299395 Mibyte bit_rate=768.006000 Kbit/s probe_score=99 TAG:encoder=Lavf58.29.100 [/FORMAT]
Conversion completed. Use Auditok to detect speech regions. Auditok detection completed. "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" has been deleted.
Converting speech regions to short-term fragments. Converting: 100% |####################################################################################| Time: 0:00:01
Sending short-term fragments to Google Speech V2 API and getting result. Speech-to-Text: 100% |################################################################################| Time: 0:00:12
Translating text from "None" to "None".
Translation: N/A% | | ETA: --:--:--Traceback (most recent call last):
File "/Users/sam/.pyenv/versions/3.8.2/bin/autosub", line 8, in
Please try to use -SRC to specify the translation source language,googletrans 4.0.0 does not seem to support automatic language recognition anymore. #158
Thanks for reply. But it's not working.
autosub -i test.mp4 -S zh-CN -SRC zh-CN -D zh-CN -o ./test.srt -bm all `Let speech lang code to match Google Speech-to-Text lang codes. Now match lang codes. Input: zh-cn Score above: 90 Match result Score (0-100) cmn-hans-cn 100 cmn-hans-hk 96 Use "cmn-hans-cn" instead. Use langcodes to standardize the result. Use "cmn-Hans-CN" instead. Speech language is the same as the destination language. Only performing speech recognition.
Convert source file to "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" to detect audio regions. /usr/local/bin/ffmpeg -hide_banner -y -i "test.mp4" -vn -ac 1 -ar 48000 -loglevel error "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav"
Use ffprobe to check conversion result. /usr/local/bin/ffprobe "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" -show_format -pretty -loglevel quiet [FORMAT] filename=/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav nb_streams=1 nb_programs=0 format_name=wav format_long_name=WAV / WAVE (Waveform Audio) start_time=N/A duration=0:01:30.650708 size=8.299395 Mibyte bit_rate=768.006000 Kbit/s probe_score=99 TAG:encoder=Lavf58.29.100 [/FORMAT]
Conversion completed. Use Auditok to detect speech regions. Auditok detection completed. "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" has been deleted.
Converting speech regions to short-term fragments. Converting: 100% |####################################################################################| Time: 0:00:01
Sending short-term fragments to Google Speech V2 API and getting result. Speech-to-Text: 100% |################################################################################| Time: 0:00:12
Translating text from "None" to "None". Translation: N/A% | | ETA: --:--:--Traceback (most recent call last): File "/Users/sam/.pyenv/versions/3.8.2/bin/autosub", line 8, in
sys.exit(main()) File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/init.py", line 159, in main cmdline_utils.audio_or_video_prcs(args, File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/cmdline_utils.py", line 1620, in audio_or_video_prcs translated_text, args.src_language = core.list_to_googletrans( File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/core.py", line 796, in list_to_googletrans translation = translator.translate(text=content_totrans, File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/googletrans/client.py", line 174, in translate dest = dest.lower().split('', 1)[0] AttributeError: 'NoneType' object has no attribute 'lower' Translation: 100% |###################################################################################| Time: 0:00:00 `
I don't understand a little bit, why do you need to output Chinese voice from Chinese video and then translate from Chinese to Chinese?Try outputting Chinese translation from videos in other languages.(For example, a video in Italian as the main language: autosub -i $filename -S it-it -SRC it -D zh-cn)
Please try to use -SRC to specify the translation source language,googletrans 4.0.0 does not seem to support automatic language recognition anymore. #158
Thanks for reply. But it's not working. autosub -i test.mp4 -S zh-CN -SRC zh-CN -D zh-CN -o ./test.srt -bm all
Let speech lang code to match Google Speech-to-Text lang codes. Now match lang codes. Input: zh-cn Score above: 90 Match result Score (0-100) cmn-hans-cn 100 cmn-hans-hk 96 Use "cmn-hans-cn" instead. Use langcodes to standardize the result. Use "cmn-Hans-CN" instead. Speech language is the same as the destination language. Only performing speech recognition. Convert source file to "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" to detect audio regions. /usr/local/bin/ffmpeg -hide_banner -y -i "test.mp4" -vn -ac 1 -ar 48000 -loglevel error "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" Use ffprobe to check conversion result. /usr/local/bin/ffprobe "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" -show_format -pretty -loglevel quiet [FORMAT] filename=/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav nb_streams=1 nb_programs=0 format_name=wav format_long_name=WAV / WAVE (Waveform Audio) start_time=N/A duration=0:01:30.650708 size=8.299395 Mibyte bit_rate=768.006000 Kbit/s probe_score=99 TAG:encoder=Lavf58.29.100 [/FORMAT] Conversion completed. Use Auditok to detect speech regions. Auditok detection completed. "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp6az08jvp.wav" has been deleted. Converting speech regions to short-term fragments. Converting: 100% |####################################################################################| Time: 0:00:01 Sending short-term fragments to Google Speech V2 API and getting result. Speech-to-Text: 100% |################################################################################| Time: 0:00:12 Translating text from "None" to "None". Translation: N/A% | | ETA: --:--:--Traceback (most recent call last): File "/Users/sam/.pyenv/versions/3.8.2/bin/autosub", line 8, in sys.exit(main()) File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/**init**.py", line 159, in main cmdline_utils.audio_or_video_prcs(args, File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/cmdline_utils.py", line 1620, in audio_or_video_prcs translated_text, args.src_language = core.list_to_googletrans( File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/core.py", line 796, in list_to_googletrans translation = translator.translate(text=content_to_trans, File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/googletrans/client.py", line 174, in translate dest = dest.lower().split('_', 1)[0] AttributeError: 'NoneType' object has no attribute 'lower' Translation: 100% |###################################################################################| Time: 0:00:00
I don't understand a little bit, why do you need to output Chinese voice from Chinese video and then translate from Chinese to Chinese?Try outputting Chinese translation from videos in other languages.(For example, a video in Italian as the main language: autosub -i $filename -S it-it -SRC it -D zh-cn)
哈哈!! 終於解決了!!謝謝你!一言驚醒了。 其實我原本是想把影片中的英文語音提取,然後翻譯成中文。 但一開始出現很多問題(與現在的問題不同)。然後每次修改後,再運行都好慢(由於影片好長),所以為了方便測試除錯,我又找了一段講中文的新聞片段,所以想提取中文出來,變成中文字幕,理論上應該都可以吧,結果解決了其彵好多問題後,還卡在現在這個問題上,但被你剛才一提醒,難道是zh-CN 不能翻譯成 zh-CN? 結果我一試,現在可以了,-S zh-CN -D en 可以,-S zh-CN -D zh-TW 也可以了。
确保你已经看过 readme,也搜索并阅读过和你遇到的情况相关的问题。否则会被认为是重复的并被立刻关闭。 Yes, I've already read #158.
描述问题 Can not generate srt file.
复现问题 复现问题的步骤:
Ctrl-A
和Ctrl-C
去复制所有输出。Let speech lang code to match Google Speech-to-Text lang codes. Now match lang codes. Input: zh-cn Score above: 90 Match result Score (0-100) cmn-hans-cn 100 cmn-hans-hk 96 Use "cmn-hans-cn" instead. Use langcodes to standardize the result. Use "cmn-Hans-CN" instead.
Convert source file to "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp424j_z2j.wav" to detect audio regions. /usr/local/bin/ffmpeg -hide_banner -y -i "test.mp4" -vn -ac 1 -ar 48000 -loglevel error "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp424j_z2j.wav"
Use ffprobe to check conversion result. /usr/local/bin/ffprobe "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp424j_z2j.wav" -show_format -pretty -loglevel quiet [FORMAT] filename=/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp424j_z2j.wav nb_streams=1 nb_programs=0 format_name=wav format_long_name=WAV / WAVE (Waveform Audio) start_time=N/A duration=0:01:30.650708 size=8.299395 Mibyte bit_rate=768.006000 Kbit/s probe_score=99 TAG:encoder=Lavf58.29.100 [/FORMAT]
Conversion completed. Use Auditok to detect speech regions. Auditok detection completed. "/var/folders/t2/7_fhbr5x7kq14p588f2hfggm0000gn/T/tmp424j_z2j.wav" has been deleted.
Converting speech regions to short-term fragments. Converting: 100% |####################################################################################| Time: 0:00:01
Sending short-term fragments to Google Speech V2 API and getting result. Speech-to-Text: 100% |################################################################################| Time: 0:00:13 Traceback (most recent call last): File "/Users/sam/.pyenv/versions/3.8.2/bin/autosub", line 8, in
sys.exit(main())
File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/init.py", line 159, in main
cmdline_utils.audio_or_video_prcs(args,
File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/cmdline_utils.py", line 1620, in audio_or_video_prcs
translated_text, args.src_language = core.list_to_googletrans(
File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/autosub/core.py", line 772, in list_to_googletrans
result_src = translator.detect(content_to_trans).lang
File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/googletrans/client.py", line 369, in detect
translated = self.translate(text, src='auto', dest='en')
File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/site-packages/googletrans/client.py", line 219, in translate
parsed = json.loads(data[0][2])
File "/Users/sam/.pyenv/versions/3.8.2/lib/python3.8/json/init.py", line 341, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
期待的行为 Generate a srt file from a mp4 video file.
截图 合适的话可以提供用以描述问题的截图。但是不推荐用截图来展示命令行输出,除非你真的认为这很有必要。
操作环境(请提供以下完整数据):
额外信息(可选) 任何其他的能描述问题的信息。