Question

I am writing a program to view an MJPEG stream with vlc. When running vlc directly through the command line I get the error message [mjpeg @ 0x10203ea00] No JPEG data found in image over and over again (with different pid's). I would like to get rid of this, as I think all of that text output is bogging down my program (and makes my text output impossible to see as it is gone about .5 seconds after it is written to console)

I am connecting to blue iris, and am implementing my program with vlcj.

http://10.10.80.39:8080/mjpg/cam1/video.mjpeg I have tried all of the quiet options that I can find, set verbosity to 0, I am at a loss on how to ignore this error.

I am running vlc 2.1. The error happens on multiple computers, and multiple os's.

Was it helpful?

Solution

You simply can't disable everything that vlc, or the libraries that vlc depends on, may emit. Not all of the log/error messages you see can be controlled by setting vlc's log level.

For me the problem is mainly libdvdnav spewing irrelevant messages to stderr.

You say you're using vlcj, well I too wanted a way to easily ignore those error messages from inside my Java applications. With the latest vlcj-git (at time of writing), there is an experimental NativeStreams [1] class that might help you.

This class uses JNA to wrap the "C" standard library and programmatically redirect either or both of the native process stdout and stderr streams.

You can not simply redirect System.out and System.err as some might expect because clearly these messages are coming from the native code outside of the JVM and that of course does not use System.out or System.err.

You can redirect to log files (which could just keep growing), or to "/dev/null".

The downside is that if you redirect the native streams, you also inevitably redirect the corresponding Java stream - you would lose your own application output. In my own applications that's not a problem because I log to stdout (which I don't redirect), whereas the vlc messsages I don't want fortuitously go to stderr (which I redirect).

You could also just redirect your java process output streams in the usual way when you launch the JVM. I wanted to be able to do this programmatically rather than having to write a shell script.

So it's not an ideal solution, but it works for me (only tested on Linux).

[1] https://github.com/caprica/vlcj/blob/a95682d5cd0fd8ac1d4d9b7a768f4b5600c87f62/src/main/java/uk/co/caprica/vlcj/runtime/streams/NativeStreams.java

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top