autosub icon indicating copy to clipboard operation
autosub copied to clipboard

Install AutoSub Step to Step in Windows with Translate subtitle

Open JeanDown123 opened this issue 7 years ago • 122 comments

Requeriments Windows 32 or 64 bits. Connection Internet. Links Downloads Python FFMPEG AutoInstall autosub_app 0.3.12.zip SampleVideos Spanish - English.zip Subtitle Editor Aegisub For Version autosub 0.3.9 Note: Uninstall Python 3.x Tutorial Video Youtube

  1. Install Python 2.7 (32 bits) https://www.python.org/ftp/python/2.7.12/python-2.7.12.msi python ## Note: Check Add Python.exe to Path

  2. Run cmd (Win+R) C:\Python27\Scripts\pip.exe install autosub Or C:\Python27\Scripts\pip.exe install https://pypi.python.org/packages/35/7b/9d5361c0f7abfcc6d826a5279b1c4501f7616505629f6c54857587ec6e37/autosub-0.3.9.tar.gz or (Download Last version autosub https://pypi.python.org/pypi/autosub) C:\Python27\Scripts\pip.exe install "c:\youdownloaded\autosub-0.3.9.tar.gz"

    Message Output Normal

    Installing collected packages: autosub
    Successfully installed autosub-0.3.9
    
    
  3. Change Name File "autosub" to "autosub_app.py" Rename C:\Python27\Scripts\autosub autosub_app.py

  4. Modify with notepad.exe or Notepad++(Edit Text) autosub_app.py 4.1 In line 48 add ", delete=False" temp = tempfile.NamedTemporaryFile(suffix='.flac') by temp = tempfile.NamedTemporaryFile(suffix='.flac', delete=False) 4.2 Eliminate line 53 os.system('stty sane'). (Optional) UPDATE For last Version Autosub (23 May 2017) In Windows xp,7,8,10 With Program Notepad change lines : Line 127 change exe_file = os.path.join(path, program) exe_file = os.path.join(path, program + ".exe") Line 47 change temp = tempfile.NamedTemporaryFile(suffix='.flac') temp = tempfile.NamedTemporaryFile(suffix='.flac', delete=False)

  5. Download(https://ffmpeg.zeranoe.com/builds/) and Copy ffmpeg.exe to C:\Python27\

  6. Restart Windows

  7. Test Script C:\Python27\python.exe C:\Python27\scripts\autosub_app.py --list-languages

SampleVideos Spanish - English.zip autosub_app 0.3.12.zip

Auto-generating subtitles for any video file

Spanish C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S es -D es TuVideo.mp4 English C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S en -D en YouVideo.mp4 Japanese C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S ja -D ja YouAnimeVideo.mp4 cmd

Optional Compile script Python(Exe Executable) C:\Python27\python.exe -m compileall C:\Python27\scripts\autosub_app.py Run C:\Python27\scripts\autosub_app.pyc YouVideo.mp4 (English Default) Upgrade Pip python -m pip install --upgrade pip

One-Click EASY with SENDTO.

autosub_app.zip Create batch by language (JA) AutoSub_Jap.bat and copy to directory SendTo "shell:sendto" "%APPDATA%\Microsoft\Windows\SendTo" AutoSub_Jap.bat C:\Python27\python.exe C:\Python27\Scripts\autosub_app.py -C 2 -S ja -D ja %1 sendto sendto

http://www.howtogeek.com/howto/windows-vista/customize-the-windows-vista-send-to-menu/ 7.- Translate your Subtitles Download Subtitle Edit https://github.com/SubtitleEdit/subtitleedit/releases SubtitleEdit-3.4.13-Setup.zip Or VersionPortable SE3413PL.zip

  • Run SubtitleEdit.exe
  • Open Subtitle (TuVideo.srt,YouAnimeVideo.srt,YouVideo)
  • Menu-Auto-Translate-(PowerbyGoogle)
  • From(Japanese) To:English
  • Translate SUBTITLEEdit

Or

https://sourceforge.net/projects/srt-tran/ SRTTRANSLATOR

Results:

Link Video Youtube Test

Comparison

Auto-Generated by Youtube President Obama Addresses the Nation on the BP Oil Spill (inglés).Youtube.srt.txt Generated by Script AutoSub President Obama Addresses the Nation on the BP Oil Spill (inglés).AutoSub.srt.txt Time Process: 01:15 Abot Minute Times are best generated by AUTOSUB.

Errors Commons in Windows

-Error install pip "python setup.py egg_info" Solution Install Python 2.7 uninstall 3.x

"WindowsError [Error 2]"

C:\Python27>python.exe C:\Python27\scripts\autosub_app.py -S en -D en test.mp4
Traceback (most recent call last):
  File "C:\Python27\scripts\autosub_app.py", line 284, in <module>
    sys.exit(main())
  File "C:\Python27\scripts\autosub_app.py", line 210, in main
    audio_filename, audio_rate = extract_audio(args.source_path)
  File "C:\Python27\scripts\autosub_app.py", line 120, in extract_audio
    subprocess.check_output(command)
  File "C:\Python27\lib\subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2]

Solution. Copy ffmpeg.exe to C:\Python27\ or Or ADD Path (Directory) File ffmpeg. Examples: c:\ffmpeg\ , c:\Program Files\ffmpeg, c:\Mydownloads
Link Help Add Path(Directory) http://www.computerhope.com/issues/ch000549.htm python

Error infinite loop

"File "C:\Python27\lib\multiprocessing\forking.py", line 380"
"File "C:\Python27\lib\multiprocessing\forking.py", line 503"
ImportError : prepare(preparation_data)

Solution Change name script C:\Python27\Scripts\autosub autosub_app.py

Error Permission denied Files Flac c:...local\temp\tmpksjd.flac Permission denied Solution: Modify Script, close file. Link https://github.com/agermanidis/autosub/issues/15

----------------------Before - Original-------------------------

class FLACConverter(object):
    def __init__(self, source_path, include_before=0.25, include_after=0.25):
        self.source_path = source_path
        self.include_before = include_before
        self.include_after = include_after

    def __call__(self, region):
        try:
            start, end = region
            start = max(0, start - self.include_before)
            end += self.include_after
            temp = tempfile.NamedTemporaryFile(suffix='.flac')
            command = ["ffmpeg", "-y", "-i", self.source_path,
                       "-ss", str(start), "-t", str(end - start),
                       "-loglevel", "error", temp.name]
            subprocess.check_output(command)
            os.system('stty sane')
            return temp.read()

----------------------After - Modified Option 1 ------------------------

class FLACConverter(object):
    def __init__(self, source_path, include_before=0.25, include_after=0.25):
        self.source_path = source_path
        self.include_before = include_before
        self.include_after = include_after

    def __call__(self, region):
        try:
            start, end = region
            start = max(0, start - self.include_before)
            end += self.include_after
            temp = tempfile.NamedTemporaryFile(suffix='.flac')      
            temp.close()
            command = ["ffmpeg", "-y", "-i", self.source_path,
                       "-ss", str(start), "-t", str(end - start),
                       "-loglevel", "error", temp.name]
            subprocess.check_output(command)
            return open(temp.name, "rb").read()

----------------------after - Modified Option 2 ------------------------

class FLACConverter(object):
    def __init__(self, source_path, include_before=0.25, include_after=0.25):
        self.source_path = source_path
        self.include_before = include_before
        self.include_after = include_after

    def __call__(self, region):
        try:
            start, end = region
            start = max(0, start - self.include_before)
            end += self.include_after
            temp = tempfile.NamedTemporaryFile(suffix='.flac', delete=False)
            command = ["ffmpeg", "-y", "-i", self.source_path,
                       "-ss", str(start), "-t", str(end - start),
                       "-loglevel", "error", temp.name]
            subprocess.check_output(command)
            return temp.read()

        except KeyboardInterrupt:
            return

Message Normal Output Pip install autosub

Collecting autosub
  Downloading autosub-0.3.9.tar.gz
Collecting google-api-python-client>=1.4.2 (from autosub)
  Downloading google_api_python_client-1.5.1-py2.py3-none-any.whl (50kB)
Collecting requests>=2.3.0 (from autosub)
  Downloading requests-2.11.0-py2.py3-none-any.whl (514kB)
Collecting pysrt>=1.0.1 (from autosub)
  Downloading pysrt-1.1.1.tar.gz (104kB)
Collecting progressbar>=2.3 (from autosub)
  Downloading progressbar-2.3.tar.gz
Collecting six<2,>=1.6.1 (from google-api-python-client>=1.4.2->autosub)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting uritemplate<1,>=0.6 (from google-api-python-client>=1.4.2->autosub)
  Downloading uritemplate-0.6.tar.gz
Collecting httplib2<1,>=0.8 (from google-api-python-client>=1.4.2->autosub)
  Downloading httplib2-0.9.2.zip (210kB)
Collecting oauth2client (from google-api-python-client>=1.4.2->autosub)
  Downloading oauth2client-3.0.0.tar.gz (77kB)
Collecting chardet (from pysrt>=1.0.1->autosub)
  Downloading chardet-2.3.0.tar.gz (164kB)
Collecting simplejson>=2.5.0 (from uritemplate<1,>=0.6->google-api-python-client>=1.4.2->autosub)
  Downloading simplejson-3.8.2-cp27-cp27m-win32.whl (65kB)
Collecting pyasn1>=0.1.7 (from oauth2client->google-api-python-client>=1.4.2->autosub)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Collecting pyasn1-modules>=0.0.5 (from oauth2client->google-api-python-client>=1.4.2->autosub)
  Downloading pyasn1_modules-0.0.8-py2.py3-none-any.whl
Collecting rsa>=3.1.4 (from oauth2client->google-api-python-client>=1.4.2->autosub)
  Downloading rsa-3.4.2-py2.py3-none-any.whl (46kB)
Installing collected packages: six, simplejson, uritemplate, httplib2, pyasn1, pyasn1-modules, rsa, oauth2client, google-api-python-client, requests, chardet, pysrt, progressbar, autosub
  Running setup.py install for uritemplate: started
    Running setup.py install for uritemplate: finished with status 'done'
  Running setup.py install for httplib2: started
    Running setup.py install for httplib2: finished with status 'done'
  Running setup.py install for oauth2client: started
    Running setup.py install for oauth2client: finished with status 'done'
  Running setup.py install for chardet: started
    Running setup.py install for chardet: finished with status 'done'
  Running setup.py install for pysrt: started
    Running setup.py install for pysrt: finished with status 'done'
  Running setup.py install for progressbar: started
    Running setup.py install for progressbar: finished with status 'done'
  Running setup.py install for autosub: started
    Running setup.py install for autosub: finished with status 'done'
Successfully installed autosub-0.3.9 chardet-2.3.0 google-api-python-client-1.5.1 httplib2-0.9.2 oauth2client-3.0.0 progressbar-2.3 pyasn1-0.1.9 pyasn1-modules-0.0.8 pysrt-1.1.1 requests-2.11.0 rsa-3.4.2 simplejson-3.8.2 six-1.10.0 uritemplate-0.6


For Version autosub 0.3.9 File For Windows Modified. Rename autosub_app.py.txt to autosub_app.py, and copy

C:\Python27\Scripts

autosub_app.py.txt SampleVideos Spanish - English.zip autosub_app 0.3.12.zip

JeanDown123 avatar Aug 08 '16 20:08 JeanDown123

I have installed autosub as described above, but I get the following error message:

E:\Completed>C:\Python27\python.exe C:\Python27\scripts\autosub_app.py --list-la
nguages
Traceback (most recent call last):
  File "C:\Python27\scripts\autosub_app.py", line 17, in <module>
    from autosub.constants import LANGUAGE_CODES, \
  File "C:\Python27\Scripts\autosub.py", line 17, in <module>
ImportError: No module named constants

I can find the constanst.py file under C:\Python27\Lib\site-packages\autosub\constants.py

SvenErik1968 avatar Aug 13 '16 08:08 SvenErik1968

Try cmd pip uninstall autosub What is your message? output? install autosub What is your message? output?

---------Message Normal install-------

Collecting autosub
Requirement already satisfied (use --upgrade to upgrade): pysrt>=1.0.1 in c:\python27\lib\site-packages (from autosub)
Requirement already satisfied (use --upgrade to upgrade): requests>=2.3.0 in c:\python27\lib\site-packages (from autosub)
Requirement already satisfied (use --upgrade to upgrade): google-api-python-client>=1.4.2 in c:\python27\lib\site-packages (from autosub)
Requirement already satisfied (use --upgrade to upgrade): progressbar>=2.3 in c:\python27\lib\site-packages (from autosub)
Requirement already satisfied (use --upgrade to upgrade): chardet in c:\python27\lib\site-packages (from pysrt>=1.0.1->autosub)
Requirement already satisfied (use --upgrade to upgrade): uritemplate<1,>=0.6 in c:\python27\lib\site-packages (from google-api-python-client>=1.4.2->autosub)
Requirement already satisfied (use --upgrade to upgrade): httplib2<1,>=0.8 in c:\python27\lib\site-packages (from google-api-python-client>=1.4.2->autosub)
Requirement already satisfied (use --upgrade to upgrade): six<2,>=1.6.1 in c:\python27\lib\site-packages (from google-api-python-client>=1.4.2->autosub)
Requirement already satisfied (use --upgrade to upgrade): oauth2client in c:\python27\lib\site-packages (from google-api-python-client>=1.4.2->autosub)
Requirement already satisfied (use --upgrade to upgrade): simplejson>=2.5.0 in c:\python27\lib\site-packages (from uritemplate<1,>=0.6->google-api-python-client>=1.4.2->autosub)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in c:\python27\lib\site-packages (from oauth2client->google-api-python-client>=1.4.2->autosub)
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules>=0.0.5 in c:\python27\lib\site-packages (from oauth2client->google-api-python-client>=1.4.2->autosub)
Requirement already satisfied (use --upgrade to upgrade): rsa>=3.1.4 in c:\python27\lib\site-packages (from oauth2client->google-api-python-client>=1.4.2->autosub)
Installing collected packages: autosub
Successfully installed autosub-0.3.9

---------Message Normal uninstall-------

Uninstalling autosub-0.3.9:
  c:\python27\lib\site-packages\autosub-0.3.9.dist-info\description.rst
  c:\python27\lib\site-packages\autosub-0.3.9.dist-info\installer
  c:\python27\lib\site-packages\autosub-0.3.9.dist-info\metadata
  c:\python27\lib\site-packages\autosub-0.3.9.dist-info\metadata.json
  c:\python27\lib\site-packages\autosub-0.3.9.dist-info\pbr.json
  c:\python27\lib\site-packages\autosub-0.3.9.dist-info\record
  c:\python27\lib\site-packages\autosub-0.3.9.dist-info\top_level.txt
  c:\python27\lib\site-packages\autosub-0.3.9.dist-info\wheel
  c:\python27\lib\site-packages\autosub\__init__.py
  c:\python27\lib\site-packages\autosub\__init__.pyc
  c:\python27\lib\site-packages\autosub\constants.py
  c:\python27\lib\site-packages\autosub\constants.pyc
  c:\python27\lib\site-packages\autosub\formatters.py
  c:\python27\lib\site-packages\autosub\formatters.pyc
  c:\python27\scripts\autosub
Proceed (y/n)? y
  Successfully uninstalled autosub-0.3.9

JeanDown123 avatar Aug 15 '16 16:08 JeanDown123

The message output were the same as you put above, but something must have changed, because it started working after I uninstalled and then installed it again.

SvenErik1968 avatar Aug 15 '16 20:08 SvenErik1968

Hi, there! I stuck on the generating step. The --list-language operation works right, I can see there are lots of choices. But it seems no matter where I put the test.mp4, autosub will not be able to find it, or maybe I've got wrong elsewhere. Would you please help me with this? The error message is down below.

C:\Python27>python.exe C:\Python27\scripts\autosub_app.py -S en -D en test.mp4
Traceback (most recent call last):
  File "C:\Python27\scripts\autosub_app.py", line 284, in <module>
    sys.exit(main())
  File "C:\Python27\scripts\autosub_app.py", line 210, in main
    audio_filename, audio_rate = extract_audio(args.source_path)
  File "C:\Python27\scripts\autosub_app.py", line 120, in extract_audio
    subprocess.check_output(command)
  File "C:\Python27\lib\subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2]

TTonyWang avatar Aug 24 '16 05:08 TTonyWang

Try with path in video C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S es -D es "c:\mypathdownload\test.mp4"

JeanDown123 avatar Aug 24 '16 16:08 JeanDown123

Thx, JeanDown123! I move the ffmpeg.exe to C:\Python and it worked, it's true that the path caused the problem.

TTonyWang avatar Aug 26 '16 01:08 TTonyWang

I installed everything like you said, but - at first - I couldn't find where any output went to. Later I did the script in a cmd window and then it said that I needed to provide the Google API key.. Any idea what I might have done wrong?

Hansdevr avatar Sep 02 '16 13:09 Hansdevr

Hansdevr: "(optionally) translates them to a different language,", Need API KEY(Price).link Free only transcriptions (For Time Limited) not Translates. Use Languaje spoken = Language Desired Example -S es -D es For Spanish -S ja -D ja For Japanese For Translate your Subtitles use other programs, example Subtitle Edit.

JeanDown123 avatar Sep 03 '16 22:09 JeanDown123

Okay, so french to french, dutch to dutch etcetera.. Right? I'll try that!

Hansdevr avatar Sep 04 '16 11:09 Hansdevr

It worked! But.. I lost a lot of sentences in the translation. It seems like AutoSub has trouble "hearing" some parts. (Damn, these French speak quik..) Would it help to 'normalize" audio (bring it to a higher and more equal level) before translating it?

Hansdevr avatar Sep 04 '16 12:09 Hansdevr

A "audio clean" help. Other option, modify code:

For length chunk or segment frame_width=4096 (2000 - 12000)

threshold = percentile(energies, 0.2) 0.2 - 0.7 (for lever noise)

Try "frame_width = 8000"

JeanDown123 avatar Sep 04 '16 16:09 JeanDown123

Thanks Jean, much appreciated! :) I'll let you know what worked best,

Hansdevr avatar Sep 04 '16 20:09 Hansdevr

Well, to be honest, it didn't make much of a difference.. :( Next, I'm going to try to do normalizing with a copy of the audio track, along with some eq-ing of the highs (low bitrate mp3 audio needs some sooping up...)

Hansdevr avatar Sep 06 '16 11:09 Hansdevr

Thank you for you work! But after completing speech recognition and the .srt file generated, there is no any text in the .srt file, so sad about it. I checked it once then I corrected the language options, but still nothing.(using a video in Chinese) Then I change a video source which's speech is in English, still nothing. Looks like I have to generate the subtitles manually, still. Just some feed back, thanks!

BigGreatGrandAwesomeWei avatar Sep 08 '16 13:09 BigGreatGrandAwesomeWei

What is the duration of the videos you tried? which was the duration of the process? Which gave the console messages? Check the audio files (flac) that are in C:\Users%username%\AppData\Local\Temp*.flac, these are the files that are sent to the translator,.

JeanDown123 avatar Sep 09 '16 03:09 JeanDown123

@JeanDown123 I'm having the same problem and i checked *.flac files they were all 0KB files. Any solution. Thanks In Advance!

ghost avatar Sep 11 '16 13:09 ghost

Try: https://www.youtube.com/watch?v=Ya6Av7uecbg Attach File Subtitles Generated By Autosub. Time Process: 01:15 - about a minute President Obama Addresses the Nation on the BP Oil Spill (inglés).AutoSub.srt.txt

JeanDown123 avatar Sep 12 '16 02:09 JeanDown123

After setting up the path to ffmpeg and after testing if ffmpeg is working or not and it did worked, i keep getting this error message: (knowin that i've a file called px.mp4 in the directory)

px.mp4: No such file or directory
Traceback (most recent call last):
  File "C:\Python27\scripts\autosub_app.py", line 284, in <module>
    sys.exit(main())
  File "C:\Python27\scripts\autosub_app.py", line 210, in main
    audio_filename, audio_rate = extract_audio(args.source_path)
  File "C:\Python27\scripts\autosub_app.py", line 120, in extract_audio
    subprocess.check_output(command)
  File "C:\Python27\lib\subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['ffmpeg', '-y', '-i', 'px.mp4', '-ac', '1', '-ar', '16000', '-loglevel', 'error', 'c:\\users\\otto\\appdata\\local\\temp\\tmpuj0j75.wav']' returned non-zero exit status 1

I think the trick is the last two lines, maybe.

Help appreciated, thanks!

MrNobdy avatar Oct 06 '16 04:10 MrNobdy

MrNobdy , think path file px.mp4. C:\Python27\scripts\autosub_app.py -S en -D en "c:\mydownloads\px.mp4"

JeanDown123 avatar Oct 14 '16 16:10 JeanDown123

Greetings. In trying to translate a video (Japanese) I get this error.

programa o archivo por lotes ejecutable. "stty" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable. "stty" no se reconoce como un comando interno o externo,####### | ETA: 0:00:00 programa o archivo por lotes ejecutable. Converting speech regions to FLAC files: 100% |#################| Time: 0:00:11 Performing speech recognition: 100% |###########################| Time: 0:05:10 Error: Subtitle translation requires specified Google Translate API key. See --help for further information.

Please help me

ghost avatar Oct 21 '16 07:10 ghost

I had try video https://www.youtube.com/watch?v=Ya6Av7uecbg

Converting speech regions to FLAC files: 100% Time 00:00:12 Performing speech recognition: 100% Time 00:00:00

Flac files is okay (not null size), but .sqr file size is 0 kb :( Please, help!

ghost avatar Nov 11 '16 22:11 ghost

Found via debugger that script need connection internet. Now it's work! :)

ghost avatar Nov 12 '16 11:11 ghost

Okay so i copied ffmpeg.exe to C:\python27

but cmd is telling it cant find it.

C:\Users"NAME">C:\Python27\python.exe C:\Python27\scripts\autosub_app.p y -S en -D en c:\1.ZBrush_Introduction.mkv ffmpeg: Executable not found on machine. Traceback (most recent call last): File "C:\Python27\scripts\autosub_app.py", line 304, in sys.exit(main()) File "C:\Python27\scripts\autosub_app.py", line 230, in main audio_filename, audio_rate = extract_audio(args.source_path) File "C:\Python27\scripts\autosub_app.py", line 140, in extract_audio raise Exception("Dependency not found: ffmpeg") Exception: Dependency not found: ffmpeg

Mistursmiley avatar Dec 15 '16 10:12 Mistursmiley

Mistursmiley, I had the same issue - you can make the script work directly with the .wav file (convert it yourself with ffmpeg or something else) and then patch the python script so that it uses the wav file directly. To do this, make the extract_audio function look like this:

def extract_audio(filename, channels=1, rate=16000): return filename, rate

Make sure to adjust the sample rate accordingly (I had a 44100 sample rate) and that it has only one channel (mono). Good luck, it did some pretty decent work for me in french.

dezea avatar Dec 16 '16 17:12 dezea

how to make it work auto in a forder?I mean make sub for all file in a folder

huyanh10tin avatar Dec 16 '16 17:12 huyanh10tin

@huyanh10tin you could modify the script so it would make a loop with all the files in the folder, or you could make a batch file wich would pass the files to the app one by one (imho it is not a good idea to process all the files at once since the google speech recognition api will probably block your access)

dezea avatar Dec 17 '16 11:12 dezea

@dezea sorry,but i dont know python language,please help me,or you could change it for me,thank

huyanh10tin avatar Dec 18 '16 11:12 huyanh10tin

To Install Python: Check "Add Python.exe to Path"? python Or ADD Path (Directory) of File ffmpeg.exe. http://www.computerhope.com/issues/ch000549.htm

JeanDown123 avatar Dec 19 '16 09:12 JeanDown123

@dezea autosub couldn't find ffmpeg for me either despite being in the same folder. I tried inserting your change to extract_audio, converting the format of the file to .wav, and setting the sample rates the same. However the following error keeps coming up.

Traceback (most recent call last):files:   0% |                | ETA:  --:--:--
  File "C:\Python27\scripts\autosub_app.py", line 295, in <module>
    sys.exit(main())
  File "C:\Python27\scripts\autosub_app.py", line 235, in main
    for i, extracted_region in enumerate(pool.imap(converter, regions)):
  File "C:\Python27\lib\multiprocessing\pool.py", line 668, in next
    raise value
NameError: global name 'false' is not defined

stringtheory178 avatar Jan 03 '17 01:01 stringtheory178

Hi,

I also have

raise Exception("Dependency not found: ffmpeg") Exception: Dependency not found: ffmpeg

ffmpeg.exe is in C:\python27 and in my PATH

is there a solution instead of extracting wav file ?

thank you

flenoir avatar Jan 03 '17 13:01 flenoir

Thank you so much for this! It will be really useful for me. But I'm having some problems using it...

  • I was getting the exception "Dependency not found: ffmpeg" whenever using a video, so I did what dezea said and extracted the audio as a .wav file.
  • Using this .wav file to generate the subtitles, it ran, and after many minutes (it's a long source video/audio) it created a .srt file, but it was empty. Apparently the user Chami93 was having this same problem, but said "Found via debugger that script need connection internet. Now it's work! :)". I am connected but it's still not working...

Can someone help me? Thanks in advance! :)

lucasgabriel-m avatar Jan 06 '17 00:01 lucasgabriel-m

@lucasgabriel-m: Don't know if I've mentioned that:

  1. the audio file must be converted to mono (the google api does not work with stereo files atm) and
  2. the resolution must be correctly specified in the script (eg, if you have set rate=44100 in the script, make sure that corresponds to your audio file). In any of these cases you'll get an empty srt file.

Btw I've managed to rewrite this script in php with some extra features supported by the google api like speech context which is really nice because it improoves recognition quite a lot and added ability to tweak the threshold and phrase lenghts.

dezea avatar Jan 06 '17 16:01 dezea

@stringtheory178 That looks like a bad edit, try using an editor which has Python syntax checking to spot any issues (also check the lines of the error codes)

dezea avatar Jan 06 '17 16:01 dezea

@dezea I'm pretty sure I just copied the line you posted. Maybe it's because my .wav file was stereo not mono. You mentioned a PHP version, any chance you could upload it?

stringtheory178 avatar Jan 07 '17 18:01 stringtheory178

@dezea Thanks for your answer. I'm kind a newbie in this, so I need a little help...

  1. Is there any command I can use to make sure ffmpeg extracts the audio already in mono?
  2. In case my rate was 44100, would I only need to change the script like below? def extract_audio(filename, channels=1, rate=44100): return filename, rate

lucasgabriel-m avatar Jan 09 '17 02:01 lucasgabriel-m

I had some problem with script finding ffmpeg.exe. It was present in c:\python27 but the script just kept on raising error which said it had not found the ffmpeg.exe. So I modified extract_audio function on line 135 throuth 145 in autosub_app.py like this:

def extract_audio(filename, channels=1, rate=16000):
    temp = tempfile.NamedTemporaryFile(suffix='.wav', delete=False)
    if not os.path.isfile(filename):
        print "The given file does not exist: {0}".format(filename)
        raise Exception("Invalid filepath: {0}".format(filename))
    #if not which("ffmpeg"):
    #    print "ffmpeg: Executable not found on machine."
    #    raise Exception("Dependency not found: ffmpeg")
    command = ["ffmpeg.exe", "-y", "-i", filename, "-ac", str(channels), "-ar", str(rate), "-loglevel", "error", temp.name]
    subprocess.check_output(command)
    return temp.name, rate

The difference?

  1. commenting out if not which("ffmpeg"):
  2. commenting out print "ffmpeg: Executable not found on machine."
  3. commenting out raise Exception("Dependency not found: ffmpeg")
  4. and changing command = ["ffmpeg",... to command = ["ffmpeg.exe",...

Simply copy the piece of code above and it's over.

mosynaq avatar Jan 09 '17 17:01 mosynaq

@mosynaq Cool, that got me past finding ffmpeg.exe, but I still get this error: Traceback (most recent call last):files: 0% | | ETA: --:--:-- File "C:\Python27\scripts\autosub_app.py", line 295, in <module> sys.exit(main()) File "C:\Python27\scripts\autosub_app.py", line 235, in main for i, extracted_region in enumerate(pool.imap(converter, regions)): File "C:\Python27\lib\multiprocessing\pool.py", line 668, in next raise value NameError: global name 'false' is not defined

Something seems to be wrong with the progress bar. what would be an easy way to just not show the progress bar or alternatively just show the percentage?

stringtheory178 avatar Jan 09 '17 17:01 stringtheory178

Sorry to bother... But I'm too stupid that I am stuck in the step"Auto-generating subtitles for any video file"... I really don't know what to do next... Hope anyone can help me, thanks. XD

jxyddtc avatar Feb 18 '17 17:02 jxyddtc

@jxyddtc You just put the video you want translated in the python27 folder, copy paste the appropriate language command and change 'youvideo.mp4' to whatever the file name is. If everything is setup right you should get a subtitle file.

stringtheory178 avatar Feb 18 '17 18:02 stringtheory178

To solve that "Exception: Dependency not found: ffmpeg", I explicitly specified the full path of my ffmpeg file like in this example: command = ["C:\\foo\\bar\\ffmpeg.exe", "-y", "-i", filename, "-ac", str(channels), "-ar", str(rate), "-loglevel", "error", temp.name] and I commented the three previous lines like that:

    #if not which("ffmpeg"):
    #    print "ffmpeg: Executable not found on machine."
    #    raise Exception("Dependency not found: ffmpeg")

And it worked. My solution was very similar to the Mosynaq fix. Believe me it is really a quick fix that works.

Glxblt76 avatar Feb 23 '17 18:02 Glxblt76

I got this error and i have tried with flac files avi files mp4 files. I use Windows Vista.

Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. Med ensamrätt.

C:\Users\Vista>cd..

C:\Users>cd..

C:>C:\Python27\scripts\autosub_app.py J:\1.avi -o J:\1.avi.srt -F srt Traceback (most recent call last): File "C:\Python27\scripts\autosub_app.py", line 284, in sys.exit(main()) File "C:\Python27\scripts\autosub_app.py", line 212, in main regions = find_speech_regions(audio_filename) File "C:\Python27\scripts\autosub_app.py", line 125, in find_speech_regions reader = wave.open(filename) File "C:\Python27\lib\wave.py", line 511, in open return Wave_read(f) File "C:\Python27\lib\wave.py", line 164, in init self.initfp(f) File "C:\Python27\lib\wave.py", line 131, in initfp raise Error, 'file does not start with RIFF id' wave.Error: file does not start with RIFF id

C:>

OldSchool297 avatar Mar 05 '17 22:03 OldSchool297

I solved it by downloading a newer autosub version against the one on githubs site: autosub-0.3.9.tar.gz

C:\Python27\Scripts\pip.exe install https://pypi.python.org/packages/5b/45/e404d9482ec6d584e34a4d24ebb2377486ccd17887515bff38fa521d6619/autosub-0.3.11.tar.gz

And it worked better when i not done this step: Modify with notepad.exe or Notepad++(Edit Text) autosub_app.py 4.1 In line 48 add ", delete=False" temp = tempfile.NamedTemporaryFile(suffix='.flac') by temp = tempfile.NamedTemporaryFile(suffix='.flac', delete=False)

Then i got another error that i saw more people had got: ("Dependency not found: ffmpeg") But i found a solution here in the comments by editing autosub_app.py.

def extract_audio(filename, channels=1, rate=16000): temp = tempfile.NamedTemporaryFile(suffix='.wav', delete=False) if not os.path.isfile(filename): print "The given file does not exist: {0}".format(filename) raise Exception("Invalid filepath: {0}".format(filename)) if not which("ffmpeg"): print "ffmpeg: Executable not found on machine." raise Exception("Dependency not found: ffmpeg") command = ["ffmpeg", "-y", "-i", filename, "-ac", str(channels), "-ar", str(rate), "-loglevel", "error", temp.name] subprocess.check_output(command) return temp.name, rate

But now i got this error when the converting only reach 0%:

Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. Med ensamrätt.

C:\Users\Vista>cd..

C:\Users>cd..

C:>C:\Python27\scripts\autosub_app.py J:\1.avi -o J:\1.srt -F srt c:\users\Vista\appdata\local\temp\tmpe1vjvu.flac: Permission denied: --:--:-- c:\users\Vista\appdata\local\temp\tmpdpjhir.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpenhi7r.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpvvzpgn.flac: Permission denied Exception in thread Thread-3: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner self.run() File "C:\Python27\lib\threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File "C:\Python27\lib\multiprocessing\pool.py", line 389, in _handle_results task = get() TypeError: ('init() takes at least 3 arguments (1 given)', <class 'subproces s.CalledProcessError'>, ())

c:\users\Vista\appdata\local\temp\tmpx7kqfd.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpc2yges.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpg5_g4t.flac: Permission denied c:\users\Vista\appdata\local\temp\tmp1e6_io.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpkyrghx.flac: Permission denied c:\users\Vista\appdata\local\temp\tmprllohy.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpuwiaj2.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpstmkrp.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpmf2qqh.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpteumpg.flac: Permission denied c:\users\Vista\appdata\local\temp\tmp_q2dym.flac: Permission denied c:\users\Vista\appdata\local\temp\tmp_fzb4s.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpscilrs.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpcs_n_f.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpzbno8f.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpzrblnr.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpirq0gm.flac: Permission denied c:\users\Vista\appdata\local\temp\tmplplrwn.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpv7afku.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpokrsc_.flac: Permission denied c:\users\Vista\appdata\local\temp\tmprbs3dv.flac: Permission deniedc:\users\Vista\appdata\local\temp\tmpxevr_u.flac: Permission deniedc:\users\Vista\appdata
local\temp\tmpnm5wiq.flac: Permission denied

c:\users\Vista\appdata\local\temp\tmpjof1ac.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpct1bpa.flac: Permission deniedc:\users\Vista\appdata\local\temp\tmpbcxlur.flac: Permission deniedc:\users\Vista\appdata
local\temp\tmpovs1jl.flac: Permission deniedc:\users\Vista\appdata\local\temp\t mpliuwsn.flac: Permission denied

c:\users\Vista\appdata\local\temp\tmpcab4de.flac: Permission denied c:\users\Vista\appdata\local\temp\tmphttq3h.flac: Permission denied c:\users\Vista\appdata\local\temp\tmp8e0sv2.flac: Permission denied c:\users\Vista\appdata\local\temp\tmp7f9ogb.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpws_s1w.flac: Permission denied c:\users\Vista\appdata\local\temp\tmpqrw7bn.flac: Permission deniedc:\users\Vista\appdata\local\temp\tmpu_nmh0.flac: Permission deniedc:\users\Vista\appdata
local\temp\tmps8zvz5.flac: Permission denied

OldSchool297 avatar Mar 06 '17 16:03 OldSchool297

How to convert online videos.

chharvi avatar Mar 08 '17 12:03 chharvi

PS C:\Users\alan> C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S en -D en YouVideo.mp4 The given file does not exist: YouVideo.mp4 Traceback (most recent call last): File "C:\Python27\scripts\autosub_app.py", line 305, in sys.exit(main()) File "C:\Python27\scripts\autosub_app.py", line 231, in main audio_filename, audio_rate = extract_audio(args.source_path) File "C:\Python27\scripts\autosub_app.py", line 138, in extract_audio raise Exception("Invalid filepath: {0}".format(filename)) Exception: Invalid filepath: YouVideo.mp4

SFNasty avatar Mar 12 '17 17:03 SFNasty

Have you tried? Replace J:\1. by the folderlocation of your file and the filename and ending etc avi, mp4.

C:\Python27\scripts\autosub_app.py J:\1.avi -o J:\1.avi.srt -F srt

OldSchool297 avatar Mar 12 '17 23:03 OldSchool297

C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S en -D en YouVideo.mp4

My file name is MP4, President Obama Addresses the Nation, and I rename to "YouVideo.mp4" The Python progamme it's in C:\ !

SFNasty avatar Mar 13 '17 08:03 SFNasty

Sorry try: C:\Python27\scripts\autosub_app.py C:\Python27\YouVideo.mp4 -o C:\Python27\YouVideo.srt -F srt

OldSchool297 avatar Mar 13 '17 16:03 OldSchool297

Au caractère Ligne:1 : 4

  • Try C:\Python27\scripts\autosub_app.py C:\Python27\YouVideo.mp4 -o C: ...
  • ~ Le bloc d’instruction est manquant dans l’instruction Try.
    • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : MissingTryStatementBlock

SFNasty avatar Mar 13 '17 17:03 SFNasty

C:\Python27\scripts\autosub_app.py C:\Python27\YouVideo.mp4 -o C:\Python27\YouVideo.srt -F srt not working too...

SFNasty avatar Mar 13 '17 17:03 SFNasty

any one can make a pach.exe ?

SFNasty avatar Mar 13 '17 17:03 SFNasty

Hi, I am not good at IT. But I am really interested in Python for autosub some videos. Anyone help me? Thanks. My email is [email protected]

angela3355 avatar Mar 21 '17 04:03 angela3355

@angela3355 Please contact me at [email protected], maybe I can help you.

humbertocastelo avatar Mar 22 '17 12:03 humbertocastelo

hi please help me friends,

$ pip.exe install autosub Collecting autosub Using cached autosub-0.3.11.tar.gz Requirement already satisfied: google-api-python-client>=1.4.2 in c:\python36\li b\site-packages (from autosub) Requirement already satisfied: requests>=2.3.0 in c:\python36\lib\site-packages (from autosub) Collecting pysrt>=1.0.1 (from autosub) Using cached pysrt-1.1.1.tar.gz Collecting progressbar>=2.3 (from autosub) Using cached progressbar-2.3.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "C:\Users\asus\AppData\Local\Temp\pip-build-9h0woum0\progressbar\setu p.py", line 5, in import progressbar File "C:\Users\asus\AppData\Local\Temp\pip-build-9h0woum0\progressbar\prog ressbar_init_.py", line 59, in from progressbar.widgets import * File "C:\Users\asus\AppData\Local\Temp\pip-build-9h0woum0\progressbar\prog ressbar\widgets.py", line 121, in class FileTransferSpeed(Widget): File "c:\python36\lib\abc.py", line 133, in new cls = super().new(mcls, name, bases, namespace) ValueError: 'format' in slots conflicts with class variable

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\asus\App Data\Local\Temp\pip-build-9h0woum0\progressbar\

wahyupoer32 avatar Mar 25 '17 17:03 wahyupoer32

I had to change line 139 from if not which("ffmpeg"): to if not which("ffmpeg.exe"):

T3rm1 avatar Apr 23 '17 12:04 T3rm1

Thanks, I got it Sent from my BlackBerry 10 smartphone. From: T3rm1Sent: 19:46 Chủ nhật, ngày 23 tháng tư năm 2017To: agermanidis/autosubReply To: agermanidis/autosubCc: angela3355; MentionSubject: Re: [agermanidis/autosub] Install AutoSub Step to Step in Windows with Translate subtitle (#31)I had to change line 139 from if not which("ffmpeg"): to if not which("ffmpeg.exe"):

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/agermanidis/autosub","title":"agermanidis/autosub","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/agermanidis/autosub"}},"updates":{"snippets":[{"icon":"PERSON","message":"@T3rm1 in #31: I had to change line 139 from\r\nif not which(\"ffmpeg\"):\r\nto\r\nif not which(\"ffmpeg.exe\"):"}],"action":{"name":"View Issue","url":"https://github.com/agermanidis/autosub/issues/31#issuecomment-296440948"}}}

angela3355 avatar Apr 23 '17 14:04 angela3355

Can you upload the AutoSub_En.bat file? or just the code? I really have no idea how to create from scratch.

tanchekwei avatar Apr 27 '17 13:04 tanchekwei

Sorry, I don't know where to find it to upload. Sent from my BlackBerry 10 smartphone. From: coolwei1Sent: 20:08 Thứ năm, ngày 27 tháng tư năm 2017To: agermanidis/autosubReply To: agermanidis/autosubCc: angela3355; MentionSubject: Re: [agermanidis/autosub] Install AutoSub Step to Step in Windows with Translate subtitle (#31)Can you upload the Autosub_En.bat file? or just the code? I really have no idea how to create from scratch.

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/agermanidis/autosub","title":"agermanidis/autosub","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/agermanidis/autosub"}},"updates":{"snippets":[{"icon":"PERSON","message":"@coolwei1 in #31: Can you upload the Autosub_En.bat file? or just the code?\r\nI really have no idea how to create from scratch."}],"action":{"name":"View Issue","url":"https://github.com/agermanidis/autosub/issues/31#issuecomment-297708105"}}}

angela3355 avatar Apr 27 '17 14:04 angela3355

angela3355 fix your posts...

T3rm1 avatar May 20 '17 10:05 T3rm1

Thanks Sent from my BlackBerry 10 smartphone. From: T3rm1Sent: 17:55 Thứ bảy, ngày 20 tháng năm năm 2017To: agermanidis/autosubReply To: agermanidis/autosubCc: angela3355; MentionSubject: Re: [agermanidis/autosub] Install AutoSub Step to Step in Windows with Translate subtitle (#31)angela3355 fix your posts...

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/agermanidis/autosub","title":"agermanidis/autosub","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/agermanidis/autosub"}},"updates":{"snippets":[{"icon":"PERSON","message":"@T3rm1 in #31: angela3355 fix your posts..."}],"action":{"name":"View Issue","url":"https://github.com/agermanidis/autosub/issues/31#issuecomment-302865939"}}}

angela3355 avatar May 20 '17 12:05 angela3355

Can anyone help me fix this error? I tried to uninstall and reinstall autosub many times but it not work. Thanks in advanced!

Traceback (most recent call last): File "C:\Python27\Scripts\autosub_app.py", line 17, in from autosub.constants import LANGUAGE_CODES,
File "C:\Python27\Scripts\autosub.py", line 17, in ImportError: No module named constants

andyou123 avatar May 26 '17 01:05 andyou123

I not sure what is the problem but you can see this (he had the same problem as yours): https://github.com/agermanidis/autosub/issues/31#issuecomment-239609826 https://github.com/agermanidis/autosub/issues/31#issuecomment-239913820

tanchekwei avatar May 26 '17 02:05 tanchekwei

https://github.com/agermanidis/autosub/issues/31#issuecomment-304172887 Thanks! I read and tried to uninstall and reinstall many times like him but it still not works.

andyou123 avatar May 26 '17 02:05 andyou123

Thanks Sent from my BlackBerry 10 smartphone. From: Chek Wei TanSent: 9:15 Thứ sáu, ngày 26 tháng năm năm 2017To: agermanidis/autosubReply To: agermanidis/autosubCc: angela3355; MentionSubject: Re: [agermanidis/autosub] Install AutoSub Step to Step in Windows with Translate subtitle (#31)I not sure what is the problem but you can see this: #31 (comment) #31 (comment)

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/agermanidis/autosub","title":"agermanidis/autosub","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/agermanidis/autosub"}},"updates":{"snippets":[{"icon":"PERSON","message":"@coolwei1 in #31: I not sure what is the problem but you can see this:\r\nhttps://github.com/agermanidis/autosub/issues/31#issuecomment-239609826\r\nhttps://github.com/agermanidis/autosub/issues/31#issuecomment-239913820"}],"action":{"name":"View Issue","url":"https://github.com/agermanidis/autosub/issues/31#issuecomment-304172887"}}}

angela3355 avatar May 26 '17 06:05 angela3355

Forgive me but I'm a newbie and 6. step gets error on my Win10 x64 I have done all the previous steps but 6. and the next says:

C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S fr -D fr sample.avi File "", line 1 C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S fr -D fr sample.avi ^ SyntaxError: invalid syntax

C:\Python27\scripts\autosub_app.py File "", line 1 C:\Python27\scripts\autosub_app.py ^ SyntaxError: invalid syntax

Cingen avatar Jul 20 '17 14:07 Cingen

Can you make a simpler program? Can you make a video instruction?

wewewe777 avatar Jul 23 '17 08:07 wewewe777

Windows PowerShell (C) Корпорация Майкрософт (Microsoft Corporation), 2016. Все права защищены.

PS C:\Users\Konstantin> C:\Python27\python.exe C:\Python27\scripts\autosub_app.py -S es -D es "c:\m\m.mp4" ffmpeg: Executable not found on machine. Traceback (most recent call last): File "C:\Python27\scripts\autosub_app.py", line 304, in sys.exit(main()) File "C:\Python27\scripts\autosub_app.py", line 230, in main audio_filename, audio_rate = extract_audio(args.source_path) File "C:\Python27\scripts\autosub_app.py", line 140, in extract_audio raise Exception("Dependency not found: ffmpeg") Exception: Dependency not found: ffmpeg PS C:\Users\Konstantin>

wewewe777 avatar Jul 23 '17 08:07 wewewe777

How to choose an American accent?

wewewe777 avatar Jul 23 '17 10:07 wewewe777

For last Version Autosub (23 May 2017) In Windows xp,7,8,10 With Program Notepad change lines : Line 127 change exe_file = os.path.join(path, program) exe_file = os.path.join(path, program + ".exe") Line 47 change temp = tempfile.NamedTemporaryFile(suffix='.flac') temp = tempfile.NamedTemporaryFile(suffix='.flac', delete=False)

Rename File "autosub 0.3.12" to "autosub_app.py" autosub_app.zip

JeanDown123 avatar Jul 24 '17 22:07 JeanDown123

Hi, Works for me now
Any one can make autosub.exe for all language ? and send it here thanks

SFNasty avatar Jul 25 '17 08:07 SFNasty

Tutorial Installation in Windows 10 - Video Youtube

https://youtu.be/4h7kAyNmVJI Link Forum #66

JeanDown123 avatar Jul 26 '17 05:07 JeanDown123

if you need help .please contact facebook :https://www.facebook.com/nguchamcom....I will help me with teamview ....

luandevpro avatar Aug 14 '17 14:08 luandevpro

I did the installation steps as posted by JeanDown123 but still got the same old "ffmpeg: Executable not found on machine." error. so in order to fix it i commented line 138 to 140 which is this part of the code: if not which("ffmpeg"): print "ffmpeg: Executable not found on machine." raise Exception("Dependency not found: ffmpeg") (I think the problem is that command "which" doesn't exist in windows yet the program tries "which ffmpeg" to get the ffmpeg address. anyway this fixed my problem. Thanks for this awesome program.

sadeghhosseini avatar Aug 16 '17 18:08 sadeghhosseini

Done everything according to the video, but when running Install_AutoSub.bat, the results don't look anything like the results on the video, here's the log (with red letters in the dos window):

Collecting autosub
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\pip\basecommand.py", line 209, in main
    status = self.run(options, args)
  File "c:\python27\lib\site-packages\pip\commands\install.py", line 299, in run

    requirement_set.prepare_files(finder)
  File "c:\python27\lib\site-packages\pip\req\req_set.py", line 360, in prepare_
files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\python27\lib\site-packages\pip\req\req_set.py", line 512, in _prepare
_file
    finder, self.upgrade, require_hashes)
  File "c:\python27\lib\site-packages\pip\req\req_install.py", line 273, in popu
late_link
    self.link = finder.find_requirement(self, upgrade)
  File "c:\python27\lib\site-packages\pip\index.py", line 440, in find_requireme
nt
    all_candidates = self.find_all_candidates(req.name)
  File "c:\python27\lib\site-packages\pip\index.py", line 398, in find_all_candi
dates
    for page in self._get_pages(url_locations, project_name):
  File "c:\python27\lib\site-packages\pip\index.py", line 543, in _get_pages
    page = self._get_page(location)
  File "c:\python27\lib\site-packages\pip\index.py", line 646, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "c:\python27\lib\site-packages\pip\index.py", line 755, in get_page
    "Cache-Control": "max-age=600",
  File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 48
0, in get
    return self.request('GET', url, **kwargs)
  File "c:\python27\lib\site-packages\pip\download.py", line 378, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 46
8, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 60
8, in send
    r.content
  File "c:\python27\lib\site-packages\pip\_vendor\requests\models.py", line 737,
 in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes
()
  File "c:\python27\lib\site-packages\pip\_vendor\requests\models.py", line 660,
 in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\resp
onse.py", line 344, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\resp
onse.py", line 301, in read
    data = self._fp.read(amt)
  File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py",
line 54, in read
    self.__callback(self.__buf.getvalue())
  File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\controller.py", l
ine 297, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "c:\python27\lib\site-packages\pip\download.py", line 281, in set
    return super(SafeFileCache, self).set(*args, **kwargs)
  File "c:\python27\lib\site-packages\pip\_vendor\cachecontrol\caches\file_cache
.py", line 99, in set
    with self.lock_class(name) as lock:
  File "c:\python27\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", li
ne 19, in __init__
    LockBase.__init__(self, path, threaded, timeout)
  File "c:\python27\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 24
2, in __init__
    hash(self.path)))
  File "c:\python27\lib\ntpath.py", line 85, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 8: ordinal
not in range(128)
- Step 1 Autosub Installed - Completed

Unfortunately I have no idea what the log means, even though it's in english. Has anyone else encountered something like this? Could someone please help me out how to continue? I'm using Windows7 64bit, if it makes a difference. Thank you in advance.

HUN-AndrewT avatar Aug 25 '17 11:08 HUN-AndrewT

wow. has it really come down to baiting users into a scam via github issues? "Just contact me @ [email protected] and I can help you" ... i really hope nobody fell for that crap

gametimebrizzle avatar Sep 12 '17 19:09 gametimebrizzle

python.exe autosub_app.py -S en -D en "C:\Users\Jonathan\Downloads\SampleVideos.Spanish.-.English\EnglishObama.mp4" Converting speech regions to FLAC files: 100% |#################| Time: 0:00:01 Traceback (most recent call last):% | | ETA: --:--:-- File "autosub_app.py", line 283, in sys.exit(main()) File "autosub_app.py", line 231, in main for i, transcript in enumerate(pool.imap(recognizer, extracted_regions)): File "apps\Python27\lib\multiprocessing\pool.py", line 668, in next raise value AttributeError: 'module' object has no attribute 'exceptions'

Anyone has the issue?

darkzbaron avatar Sep 21 '17 14:09 darkzbaron

multiple files in send to:

@echo off

for %%i in (%*) do C:\Python27\python.exe C:\Python27\Scripts\autosub_app.py -C 2 -S en -D en %%i

andersoncustodio avatar Oct 24 '17 04:10 andersoncustodio

ffmpeg How to fix this???

darmawi30 avatar Dec 03 '17 02:12 darmawi30

Error: Subtitle translation requires specified Google Translate API key. See --help for further information. How to fix this error??

darmawi30 avatar Dec 03 '17 04:12 darmawi30

I have resolved the above issues, but I need Google API Key when changing from Japanese to English.

English was not a problem in English.

image

Shinelazy2 avatar Dec 03 '17 04:12 Shinelazy2

api How to use Google Translate API Key ???

darmawi30 avatar Dec 03 '17 10:12 darmawi30

Some Time Speech Recogination Percentage Freeze at some percentage

tahercoolguy avatar Dec 28 '17 07:12 tahercoolguy

i tested a recording in german and the srt files get 3 lines out of a 3-min monologue, guess maybe the google api doesn't work well with noises? since all 3 lines comes from recording clip with no noise at all.

fangch2004 avatar Jan 20 '18 09:01 fangch2004

untitled test

May I know how to resolve this problem?

Canoup avatar Jan 28 '18 15:01 Canoup

Anyone who have this problem "ffmpeg: Executable not found on machine"

Just replace follow words in "autosub_app.py", and it's done!!!!

def extract_audio(filename, channels=1, rate=16000): temp = tempfile.NamedTemporaryFile(suffix='.wav', delete=False) if not os.path.isfile(filename): print "The given file does not exist: {0}".format(filename) raise Exception("Invalid filepath: {0}".format(filename)) #if not which("ffmpeg"): # print "ffmpeg: Executable not found on machine." # raise Exception("Dependency not found: ffmpeg") command = ["ffmpeg.exe", "-y", "-i", filename, "-ac", str(channels), "-ar", str(rate), "-loglevel", "error", temp.name] subprocess.check_output(command) return temp.name, rate

Leowanttalk avatar Jun 09 '18 16:06 Leowanttalk

multiple files in send to:

@echo off

for %%i in (%*) do C:\Python27\python.exe C:\Python27\Scripts\autosub_app.py -C 2 -S en -D en %%i

could you explain how to use this code to generate a subtitle for multiple file please ?

Mr-Cetto avatar Oct 05 '18 23:10 Mr-Cetto

how can i create AutoSub.bat file for any language i need ?

Mr-Cetto avatar Oct 05 '18 23:10 Mr-Cetto

I successfully created the SRT file, but it's blank. Could you help me answer that question? Thank you so much.

Panyidan avatar Oct 28 '18 13:10 Panyidan

I successfully created the SRT file, but it's blank. Could you help me answer that question? Thank you so much.

ME TOO. AND i dont find any solutions

slarkleo avatar Nov 10 '18 10:11 slarkleo

I successfully created the SRT file, but it's blank. Could you help me answer that question? Thank you so much.

ME TOO. AND i dont find any solutions

i find it , because in chinese , you cant use google server.

you should use a vpn to make a srt file

slarkleo avatar Nov 10 '18 10:11 slarkleo

I did every step by following tutorial video. But in the last step, when I make mp4 file send to the batch file, no result get back. No new file is created. I don't know why cmd windows just appeared then suddenly disappeared. Is there anyone can tell me why??? Thanks a lot!!!

Hearin avatar Nov 10 '18 14:11 Hearin

For Google Translate API Key have some tricks: https://ctrlq.org/code/19909-google-translate-api https://github.com/matheuss/google-translate-api

timoteo7 avatar Nov 19 '18 01:11 timoteo7

Greetings. In trying to translate a video (Japanese) I get this error.

programa o archivo por lotes ejecutable. "stty" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable. "stty" no se reconoce como un comando interno o externo,####### | ETA: 0:00:00 programa o archivo por lotes ejecutable. Converting speech regions to FLAC files: 100% |#################| Time: 0:00:11 Performing speech recognition: 100% |###########################| Time: 0:05:10 Error: Subtitle translation requires specified Google Translate API key. See --help for further information.

Please help me

You can still get the SRT file without any problem. Or you can delete the line 53 as suggested by him.

HBeing3 avatar Dec 09 '18 23:12 HBeing3

I successfully created the SRT file, but it's blank. Could you help me answer that question? Thank you so much.

You need to "climb over" the GFW lollll. A VPN would make it work.

pengtiancn avatar Dec 27 '18 03:12 pengtiancn

I followed the instructions and made it! Thank you very much! I have a follow-up request but don't know how to do it. Can autosub or other Python features transfer the srt file into a plain text file without the timecodes? I now use a subtitle software but I'm thinking maybe there's some easier/quicker approach within Python.

pengtiancn avatar Dec 27 '18 03:12 pengtiancn

I have installed autosub as described above, but I get the following error message:

E:\Completed>C:\Python27\python.exe C:\Python27\scripts\autosub_app.py --list-la
nguages
Traceback (most recent call last):
  File "C:\Python27\scripts\autosub_app.py", line 17, in <module>
    from autosub.constants import LANGUAGE_CODES, \
  File "C:\Python27\Scripts\autosub.py", line 17, in <module>
ImportError: No module named constants

I can find the constanst.py file under C:\Python27\Lib\site-packages\autosub\constants.py

I know the reason. You must change autosub to other name, because it is same to package name.

v2up avatar Jan 21 '19 16:01 v2up

Does the same languages srt converter need google api ? I don't use translate different languages services.

ghost avatar Mar 30 '19 16:03 ghost

Does the same languages srt converter need google api ? I don't use translate different languages services.

如果你指的是语音识别是否需要翻译api,这个答案是不需要,具体语音识别和翻译api的区别和来源参考 #111 至于只输入源语言选项却提示要翻译api的情况,是一个已知的bug,可以参考 #136

BingLingGroup avatar Apr 01 '19 14:04 BingLingGroup

Does the same languages srt converter need google api ? I don't use translate different languages services.

如果你指的是语音识别是否需要翻译api,这个答案是不需要,具体语音识别和翻译api的区别和来源参考 #111 至于只输入源语言选项却提示要翻译api的情况,是一个已知的bug,可以参考 #136

音频是 EN, 从 EN 导出EN 字幕。不翻译成ZH。 因为翻译工作可以用字幕软件翻译,不需要autosub翻译。但是就是EN to EN ,也是空文件。原因是因为相同语言也要调用Google Api 吧?所以还是要翻墙。

ghost avatar Apr 02 '19 10:04 ghost

Does the same languages srt converter need google api ? I don't use translate different languages services.

如果你指的是语音识别是否需要翻译api,这个答案是不需要,具体语音识别和翻译api的区别和来源参考 #111 至于只输入源语言选项却提示要翻译api的情况,是一个已知的bug,可以参考 #136

音频是 EN, 从 EN 导出EN 字幕。不翻译成ZH。 因为翻译工作可以用字幕软件翻译,不需要autosub翻译。但是就是EN to EN ,也是空文件。原因是因为相同语言也要调用Google Api 吧?所以还是要翻墙。

那肯定的,这必须要先能连上google。

BingLingGroup avatar Apr 06 '19 02:04 BingLingGroup

The English language which it auto-captions looks like Indian English because of I Indian words in it. I tried to change the regional language in my PC to English (united states) as well speech language to English (united states) which earlier was English (India). I then reinstalled the autosub but still gives me the same wrong captions for the video. Here are the Auto captions for the same OBAMA VIDEO which yo put the link in the description. President Obama Addresses the Nation on the BP Oil Spill - Copy.srt.txt

ghost avatar Jun 30 '19 09:06 ghost