Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Video file appears to lack subtitle stream" #203

Closed
RicardoCapricciosa opened this issue Dec 21, 2024 · 5 comments
Closed

"Video file appears to lack subtitle stream" #203

RicardoCapricciosa opened this issue Dec 21, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@RicardoCapricciosa
Copy link

Environment (please complete the following information):

  • OS: Windows 11 (WSL)
  • python version (python --version): richa@quantumk:/mnt/h/Media/Movies$ python3 --version
    Python 3.12.3
  • subsync version (subsync --version): richa@quantumk:/mnt/h/Media/Movies$ subsync --version
    ffsubsync 0.4.26

Describe the bug
I get the following error with some files

richa@quantumk:/mnt/h/Media/Movies$ ffs acs.mkv -i acs.en.unsynced.srt -o acs.en.synced.srt
[11:54:28] INFO     extracting speech segments from reference 'acs.mkv'...                                                                                                                                                                                    ffsubsync.py:436
           INFO     Checking video for subtitles stream...                                                                                                                                                                                          speech_transformers.py:309
           INFO     Video file appears to lack subtitle stream                                                                                                                                                                                      speech_transformers.py:314
Traceback (most recent call last):
  File "/home/richa/.local/bin/ffs", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 719, in main
    return run(parser)["retval"]
           ^^^^^^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 501, in run
    sync_was_successful = _run_impl(args, result)
                          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 437, in _run_impl
    reference_pipe.fit(args.reference)
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/sklearn_shim.py", line 255, in fit
    self._final_estimator.fit(Xt, y, **fit_params)
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/speech_transformers.py", line 333, in fit
    detector = _make_webrtcvad_detector(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/speech_transformers.py", line 136, in _make_webrtcvad_detector
    import webrtcvad
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/webrtcvad.py", line 1, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

To Reproduce
It just happens with some mkv files. They in fact do have subtitle tracks included, but not srt, but PGS. But that should not even matter in my opinion because ffs should use the audio to sync the suppolied srt subs as input.

Expected behavior
the subtitles should be synced and written to the stated output file

Output
see above

Test case
[Optional] You can bundle additional debugging information into a tar archive as follows:

subsync vid.mkv -i in.srt -o out.srt --make-test-case

This doesn't work either, it errors with

richa@quantumk:/mnt/h/Media/Movies$ subsync acs.mkv -i acs.en.unsynced.srt -o acs.en.synced.srt --make-test-case
[12:08:43] INFO     this log will be written to /mnt/h/Media/Movies/ffsubsync.log                                                                                                                                                  ffsubsync.py:418
           INFO     extracting speech segments from reference 'acs.mkv'...                                                                                                                                                         ffsubsync.py:436
           INFO     Checking video for subtitles stream...                                                                                                                                                               speech_transformers.py:309
           INFO     Video file appears to lack subtitle stream                                                                                                                                                           speech_transformers.py:314
           INFO     creating test archive acs.mkv.2024-12-21-12-08-43.tar.gz...                                                                                                                                                     ffsubsync.py:63
Traceback (most recent call last):
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 501, in run
    sync_was_successful = _run_impl(args, result)
                          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 437, in _run_impl
    reference_pipe.fit(args.reference)
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/sklearn_shim.py", line 255, in fit
    self._final_estimator.fit(Xt, y, **fit_params)
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/speech_transformers.py", line 333, in fit
    detector = _make_webrtcvad_detector(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/speech_transformers.py", line 136, in _make_webrtcvad_detector
    import webrtcvad
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/webrtcvad.py", line 1, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.12/shutil.py", line 886, in move
    os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: 'acs.npz' -> 'acs.mkv.2024-12-21-12-08-43/acs.npz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/richa/.local/bin/subsync", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 719, in main
    return run(parser)["retval"]
           ^^^^^^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 509, in run
    result["retval"] += make_test_case(
                        ^^^^^^^^^^^^^^^
  File "/home/richa/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 78, in make_test_case
    shutil.move(npy_savename, tar_dir)
  File "/usr/lib/python3.12/shutil.py", line 906, in move
    copy_function(src, real_dst)
  File "/usr/lib/python3.12/shutil.py", line 475, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.12/shutil.py", line 260, in copyfile
    with open(src, 'rb') as fsrc:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'acs.npz'
@RicardoCapricciosa RicardoCapricciosa added the bug Something isn't working label Dec 21, 2024
@smacke
Copy link
Owner

smacke commented Dec 21, 2024

Could you try pip install --upgrade setuptools and try again? perhaps this dependency got messed up somehow.

The "video file lacks subtitle stream" is just informational and means that ffsubsync will try to use the audio to sync instead instead of subtitles (which are preferable when they're available). The error is because webrtcvad is trying to import pkg_resources which isn't found for some reason.

@RicardoCapricciosa
Copy link
Author

RicardoCapricciosa commented Dec 23, 2024

Hi, thanks, this what I tried. It seems that setuptools is already installed:

richa@quantumk:~$ sudo pip install --upgrade setuptools
[sudo] password for richa:
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
richa@quantumk:~$ sudo apt install python3-setuptools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-setuptools is already the newest version (68.1.2-2ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
richa@quantumk:~$

Also, I want to mention again, that it's not always like this, just with some files. I could not yet determine on which files exactly it happens.

@smacke
Copy link
Owner

smacke commented Dec 23, 2024

@RicardoCapricciosa probably you're not installed setuptools in the same environment where ffsubsync was installed. Assuming you used pipx to run ffsubsync originally, please try the following:

pipx inject ffsubsync setuptools

@smacke
Copy link
Owner

smacke commented Dec 25, 2024

This should be fixed in the latest release. Feel free to open a new issue if it persists after upgrading.

@smacke smacke closed this as completed Dec 25, 2024
@RicardoCapricciosa
Copy link
Author

@RicardoCapricciosa probably you're not installed setuptools in the same environment where ffsubsync was installed. Assuming you used pipx to run ffsubsync originally, please try the following:

pipx inject ffsubsync setuptools

that worked, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants