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

Fix issue #195. Redirect stdout/err to /dev/null #417

Merged
merged 2 commits into from
Dec 6, 2020
Merged

Fix issue #195. Redirect stdout/err to /dev/null #417

merged 2 commits into from
Dec 6, 2020

Conversation

0x3333
Copy link
Contributor

@0x3333 0x3333 commented Sep 16, 2020

Fixes #195

Redirect stdout/stderr to DEVNULL when quiet is requested, otherwise, the buffer will be filled until a MemoryError on long encodings.

@0x3333
Copy link
Contributor Author

0x3333 commented Oct 14, 2020

Any news on this one? Straightforward change

@0x3333
Copy link
Contributor Author

0x3333 commented Oct 19, 2020

@kkroening

@ArchieMeng
Copy link

Have you already tested the code?
I used the same fix, but problem still exists.

@0x3333
Copy link
Contributor Author

0x3333 commented Oct 30, 2020

@ArchieMeng could you check with the latest version? I changed it slightly to cover all cases.

I tested in my use case, which is:

        self._ffmpeg_proc = (
            ffmpeg.input("pipe:", format="rawvideo", pix_fmt="yuyv422", s=resolution, framerate=cfg().calculate_fps())
            .output(self._filename, vcodec=cfg().record_codec)
            .overwrite_output()
            .run_async(pipe_stdin=True, quiet=True)
        )

Copy link
Collaborator

@depau depau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone else please confirm that this works as intended?

@sam210723
Copy link

Patched and running fine in v0.2.0. Here's how run_async is being called:

def run(self):
  """
  Run channel encoder
  """

  self.process = (
    self.output.run_async(
      quiet=self.quiet
    )
  )
  self.print("Running")

  return_code = self.process.wait()
  if return_code:
    self.print(f"Exited with code {return_code}")

@0x3333
Copy link
Contributor Author

0x3333 commented Dec 5, 2020

Just for the record, the secret here is to redirect stderr to stdout and then redirect stdout to /dev/null, otherwise, it doesn't work redirecting both to /dev/null.

@depau depau merged commit 0612a44 into kkroening:master Dec 6, 2020
@depau
Copy link
Collaborator

depau commented Dec 6, 2020

Just for the record, the secret here is to redirect stderr to stdout and then redirect stdout to /dev/null, otherwise, it doesn't work redirecting both to /dev/null.

That's a weird bug 🤔

@ArchieMeng
Copy link

Yes. It works. Thank you.

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

Successfully merging this pull request may close these issues.

quiet mode for run_async method might cause ffmpeg process to stick.
4 participants