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

FFprobe not working at all #667

Open
fluffy-critter opened this issue Oct 28, 2023 · 6 comments
Open

FFprobe not working at all #667

fluffy-critter opened this issue Oct 28, 2023 · 6 comments

Comments

@fluffy-critter
Copy link

It looks like the FFprobe mechanism is currently broken.

>>> FFprobe('tests/album/test track.wav')
2023-10-28 00:15:01,565 - pyffmpeg.pseudo_ffprobe.FFprobe - INFO - FFprobe initialised
2023-10-28 00:15:01,567 - pyffmpeg.misc.Paths - INFO - bin folder: /Users/fluffy/.pyffmpeg/bin
2023-10-28 00:15:01,567 - pyffmpeg.misc.Paths - INFO - Inside load_ffmpeg_bin
2023-10-28 00:15:01,567 - pyffmpeg.pseudo_ffprobe.FFprobe - INFO - ffmpeg bin: /Users/fluffy/.pyffmpeg/bin/ffmpeg
2023-10-28 00:15:01,567 - pyffmpeg.pseudo_ffprobe.FFprobe - INFO - Inside probe
2023-10-28 00:15:01,567 - pyffmpeg.pseudo_ffprobe.FFprobe - INFO - Probing file: "tests/album/test track.wav"
2023-10-28 00:15:01,567 - pyffmpeg.pseudo_ffprobe.FFprobe - INFO - Issuing commads ['/Users/fluffy/.pyffmpeg/bin/ffmpeg', '-y', '-i', 'tests/album/test track.wav', '-f', 'null', '/dev/null']
2023-10-28 00:15:02,076 - pyffmpeg.pseudo_ffprobe.FFprobe - INFO - Inside _extract_all
2023-10-28 00:15:02,076 - pyffmpeg.pseudo_ffprobe.FFprobe - ERROR - Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/fluffy/Library/Caches/pypoetry/virtualenvs/bandcrash-nnauGvj1-py3.11/lib/python3.11/site-packages/pyffmpeg/pseudo_ffprobe.py", line 63, in __init__
    self.probe()
  File "/Users/fluffy/Library/Caches/pypoetry/virtualenvs/bandcrash-nnauGvj1-py3.11/lib/python3.11/site-packages/pyffmpeg/pseudo_ffprobe.py", line 289, in probe
    self._extract_all(stdout)
  File "/Users/fluffy/Library/Caches/pypoetry/virtualenvs/bandcrash-nnauGvj1-py3.11/lib/python3.11/site-packages/pyffmpeg/pseudo_ffprobe.py", line 112, in _extract_all
    raise Exception(self.error)
Exception: Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

>>> 

The installed version of ffmpeg:

$ ~/.pyffmpeg/bin/ffmpeg --help
ffmpeg version N-108453-gb0c7352cd4-tessus Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
@alinsavix
Copy link

What's really strange about this (and I'm experiencing the same) is that if I take the command it says is being executed (in the debug output, and run it directly myself, it works fine!

@fluffy-critter
Copy link
Author

Hm, might be something to do with TTY output on the ffmpeg binary? ffmpeg does some really weird stuff with terminal detection.

@dust333
Copy link

dust333 commented Feb 21, 2024

in class FFProbe in method probe replace

commands = [
            self._ffmpeg, '-y', '-i',
            self.file_name, '-f',
            'null', os.devnull]

with
commands = f"{self._ffmpeg} -y -i {self.file_name} -f null {os.devnull}"

as temporary solution

@amoh-godwin
Copy link
Contributor

I have made a new release. I suspect that could be it. If it doesn't work I will try and fix it.

@solovieff
Copy link

@dust333 solution still seems to be the only way at the moment.

@solovieff
Copy link

class FFprobeFixed(FFprobe):
    def probe(self):
        self.logger.info('Inside probe')
        self.logger.info(f'Probing file: "{self.file_name}"')

        # randomize the filename to avoid overwrite prompt

        commands = f"{self._ffmpeg} -y -i {self.file_name} -f null {os.devnull}"

        self.logger.info(f"Issuing commads {str(commands)}")

        # start subprocess
        subP = subprocess.Popen(
            commands,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            text=True,
            shell=SHELL)

        # break the operation
        sleep(0.5)
        stdout, _ = subP.communicate(input='q')

        self._extract_all(stdout)

        # Expose publicly know var
        self._expose()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants