rxbots
rxbots

Reputation: 87

How to get VLC to shut up with it's prefetch errors?

Python 2.7 lib-vlc keeps printing [00000000081257d0] prefetch stream error: unimplemented query (264) in control whenever a new song plays

p.play() causes the issue.

I've found in a few places that this error means literally nothing and that VLC just outputs it for seemingly no reason. I haven't found any way around it.

I found a few threads explaining how to silence another library's prints using this code, but it didn't have any effect.

save_stdout = sys.stdout
sys.stdout = io.BytesIO()
self.p.play()
sys.stdout = save_stdout

Since there was no result, is there any way to hush vlc from spamming the console with prefetch errors?

Upvotes: 2

Views: 3837

Answers (2)

mfkl
mfkl

Reputation: 2184

Console logger (console)
  -q, --quiet, --no-quiet        Be quiet
                                 (default disabled)
          Turn off all messages on the console.

https://wiki.videolan.org/VLC_command-line_help/

Upvotes: 4

Jack Taylor
Jack Taylor

Reputation: 6227

I had a look at the VLC source code, and the error message in question is generated in the C code, and is written to stderr. This means two things:

  1. Redirecting stdout won't work, as stdout and stderr use different file handles.
  2. Redirecting at the Python level won't work, as Python's sys.stderr only wraps the C-level stderr; it doesn't alter it.

To make it work, you need to redirect stderr at the C level. Eli Bendersky has a great writeup about redirecting C-level stdout in Python; maybe you can adapt that code for stderr, and to work with Python 2.

Upvotes: 3

Related Questions