m1guelpf / auto-subtitle

Automatically generate and overlay subtitles for any video.
MIT License
1.35k stars 225 forks source link

Print ffmpeg errors #23

Open binarykitchen opened 1 year ago

binarykitchen commented 1 year ago

For unknown reasons the ffmpeg command fails without telling me why:

$ auto_subtitle ./videomail_preview.webm -o subtitled/

prints following:

Extracting audio from videomail_preview...
Generating subtitles for videomail_preview... This might take a while.
Detected language: English
  0%|                                                                                                                                                                                            | 0/69 [00:11<?, ?frames/s]
Adding subtitles to videomail_preview...
Traceback (most recent call last):
  File "/Users/michaelheuberger/.pyenv/versions/3.10.4/bin/auto_subtitle", line 33, in <module>
    sys.exit(load_entry_point('auto-subtitle==1.0', 'console_scripts', 'auto_subtitle')())
  File "/Users/michaelheuberger/.pyenv/versions/3.10.4/lib/python3.10/site-packages/auto_subtitle/cli.py", line 61, in main
    stderr = ffmpeg.concat(
  File "/Users/michaelheuberger/.pyenv/versions/3.10.4/lib/python3.10/site-packages/ffmpeg/_run.py", line 325, in run
    raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

On MacOS here, using python v3.10.4 installed via pyenv and using ffmpeg v5.1.2 - any clues? Thanks

tommyct614 commented 1 year ago

Did you manage to solve this?

binarykitchen commented 1 year ago

no

tommyct614 commented 1 year ago

It worked for me by adding '--output_srt true' as a second argument.

binarykitchen commented 1 year ago

Hmm, thanks mate but getting weirder errors now:

Traceback (most recent call last):
  File "/home/michael-heuberger/.pyenv/versions/3.11.1/bin/auto_subtitle", line 33, in <module>
    sys.exit(load_entry_point('auto-subtitle==1.0', 'console_scripts', 'auto_subtitle')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/michael-heuberger/.pyenv/versions/3.11.1/lib/python3.11/site-packages/auto_subtitle/cli.py", line 60, in main

    ).output(out_path).run(quiet=True, overwrite_output=True)

stderr
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/michael-heuberger/.pyenv/versions/3.11.1/lib/python3.11/site-packages/ffmpeg/_run.py", line 325, in run

    raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

stderr
23:54:07.714 ERROR videomail.io@infernal.videomail.local:
  0%|          | 0/657 [00:21<?, ?frames/s]
    Traceback (most recent call last):
      File "/home/michael-heuberger/.pyenv/versions/3.11.1/bin/auto_subtitle", line 33, in <module>
        sys.exit(load_entry_point('auto-subtitle==1.0', 'console_scripts', 'auto_subtitle')())
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/michael-heuberger/.pyenv/versions/3.11.1/lib/python3.11/site-packages/auto_subtitle/cli.py", line 60, in main
        ).output(out_path).run(quiet=True, overwrite_output=True)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/michael-heuberger/.pyenv/versions/3.11.1/lib/python3.11/site-packages/ffmpeg/_run.py", line 325, in run
        raise Error('ffmpeg', out, err)
    ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

23:54:07.746 TRACE videomail.io@infernal.videomail.local: client.onEnd (no event)
23:54:07.758 TRACE videomail.io@infernal.videomail.local: Received POST on /client-error/?x-videomail-site-name=videomail.io, processing now ...
Sun, 05 Feb 2023 10:54:07 GMT express deprecated req.host: Use req.hostname instead at node_modules/lodash/lodash.js:4837:28
23:54:07.799  WARN videomail.io@infernal.videomail.local:
    Oh no, server error!
  0%|          | 0/657 [00:21<?, ?frames/s]
    Traceback (most recent call last):
      File "/home/michael-heuberger/.pyenv/versions/3.11.1/bin/auto_subtitle", line 33, in <module>
        sys.exit(load_entry_point('auto-subtitle==1.0', 'console_scripts', 'auto_subtitle')())
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/michael-heuberger/.pyenv/versions/3.11.1/lib/python3.11/site-packages/auto_subtitle/cli.py", line 60, in main
        ).output(out_path).run(quiet=True, overwrite_output=True)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/michael-heuberger/.pyenv/versions/3.11.1/lib/python3.11/site-packages/ffmpeg/_run.py", line 325, in run
        raise Error('ffmpeg', out, err)
    ffmpeg._run.Error: ffmpeg error (see stderr output for detail)
    "
binarykitchen commented 1 year ago

And funnily I wasn't talking nor saying anything during recording but it picked Nyorsk for the detected language hmmm...

tarasyyyk commented 1 year ago

@binarykitchen You can edit source file /Users/michaelheuberger/.pyenv/versions/3.10.4/lib/python3.10/site-packages/auto_subtitle/cli.py, line 61 to get more verbose error output.

Or you can generate subtitle separately (with option --srt_only true) and then merge your video with this subtitle file: ffmpeg -i video.mp4 -i subtitle.srt -c copy -c:s mov_text output_video.mp4. Read more here on Stackoverflow about how to do it. Actually with this ffmpeg command you have more options to add subtitles: you can add soft/hard subs, change color, font, etc.

binarykitchen commented 1 year ago

@binarykitchen You can edit source file /Users/michaelheuberger/.pyenv/versions/3.10.4/lib/python3.10/site-packages/auto_subtitle/cli.py, line 61 to get more verbose error output.

Why not add a new verbose parameter to get this printed? And shouldn't any stderr output be shown by default anyway?

mockinbirdy commented 1 year ago

@binarykitchen You can edit source file /Users/michaelheuberger/.pyenv/versions/3.10.4/lib/python3.10/site-packages/auto_subtitle/cli.py, line 61 to get more verbose error output.

Or you can generate subtitle separately (with option --srt_only true) and then merge your video with this subtitle file: ffmpeg -i video.mp4 -i subtitle.srt -c copy -c:s mov_text output_video.mp4. Read more here on Stackoverflow about how to do it. Actually with this ffmpeg command you have more options to add subtitles: you can add soft/hard subs, change color, font, etc.

Can you tell me what should be the command to run it without ffmpeg cause the error cannot seem to be fixed. Because it still shows me the same error even when I try to generate subtitles separately. Thanks.

Kavan27 commented 1 year ago

I fixed it by fixing the path, I had /videos/video.mp4 changed it to videos/video.mp4

zaltinsoy commented 3 weeks ago

https://github.com/m1guelpf/auto-subtitle/pull/89/ Version in this pull request solved my path related problem in Windows.