How to tell a third-party library to STFU



  • It seems like StackOverflow is full of people who only pursue quick rep by answering the same "how do I loop" questions over and over lately, so time to ask you guys.

    http://stackoverflow.com/questions/27938049/a-third-party-library-ffmpeg-is-spamming-output

    TL;DR version: I'm using AForge, which uses FFMpeg, which complains about buffer underflows which I can't do anything about and which don't seem to affect the video anyway, but it bubbles up to my console and even disabling stdout and stderr doesn't do anything (it seems like it's using some direct write-to-console APIs or something). What do I do?



  • Doesn't look too hard to build from source:



  • Disclaimer: I don't know anything about C#, or ffmpeg, but I am bored so I'll take a swing anyway. Not at providing a solution, but att guessing what is going on.

    Buffer underrun sounds a bit like what's going on when latex complains about similar stuff. This only means that there is no pretty way of filling and right-justify the current line or paragraph, and so it will 'jut out' a bit to the right. Nothing harmful, in other words, just the parser complaining that it ought to be able to do a better job.

    Ffmpeg appears to be written in C/C++, so the direct write to console api you are reffering to is probably iostream. Ergo, you can tell C# to shut up all you like, but it's the included lib-file (a dll by the looks of things) that does all the chatting.

    Have a look at the link so graciously provided by @Eldelshell and see if there aren't any configuration parameters there that you can play with?



  • Also, maybe Aforge is using a customized build with lots of debugging symbols enabled. Maybe try downloading the official build.



  • ffmpeg's executable has -v silent or something similar (if I remembered wrong), so there's probably some way to do that from the library.



  • Such as int opt_loglevel(void *optctx, const char *opt, const char *arg) in cmdutils.h

    ... But if you dig deeper there is probably a better way to do it...



  • @Eldelshell said:

    Doesn't look too hard to build from source:

    I hate building from source on Windows, it never works. But that gives me an idea...


    Okay, I ended up breaking out a trusty disassembler and replacing a call in av_log to av_vlog with a string of NOPs. WTFy? Definitely. But hey, surprisingly it does the job.



  • The answer may have been in the question. Try this:



  • Well, that works too, and probably is a better solution. Thanks.


Log in to reply