Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-06-2018, 08:07 AM
|
#1
|
LQ Newbie
Registered: Apr 2014
Distribution: Xubuntu, Arch
Posts: 20
Rep:
|
Why do some tools (e.g. ffprobe) split their output between sdtout and stderr ?
If you want to grep in all output (or want to write all to a file), you always need to 2>&1.
I understand that tools whose purpose is to process some input and write the result to output (e.g. sed) need to handle output and error messages separately. Another example is wget, where you only want to have the downloaded content in stdout. For all these, I think splitting is fine.
But I don't understand this behavior in tools like ffprobe, whose purpose is to analyze a file and then write the result.
|
|
|
01-06-2018, 08:32 AM
|
#2
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,985
|
STDOUT is intended for "things that you might wish to 'pipe' as input to the next program in the chain." These are "the legitimate outputs" of the program, representing the results that it is tasked to produce.
STDIN is the input-stream of data that a program might expect to have piped-in to it. (If your program needs more-than-one input stream, you have to rig it yourself.)
Meanwhile, STDERR is the chatter-box, where you're talking to the person who is watching the blinking lights. Status messages, error messages, progress messages and so forth. You can instruct the shell to combine the two streams if you wish. You can also divert it to /dev/null, thereby discarding it completely.
Last edited by sundialsvcs; 01-06-2018 at 08:33 AM.
|
|
1 members found this post helpful.
|
01-06-2018, 09:38 AM
|
#3
|
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
|
|
|
|
01-06-2018, 10:06 AM
|
#4
|
LQ Newbie
Registered: Apr 2014
Distribution: Xubuntu, Arch
Posts: 20
Original Poster
Rep:
|
Well ... then ffprobe is doing it wrong.
when I use ffprobe -show_streams, both stdout and stderr contain information I'm interested in (and that I pipe to grep or less). In this example, stderr contains info about the streams, not error messages.
I've seen this behavior long time ago in other tools, to, but I don't remember which ones.
|
|
|
01-06-2018, 10:17 AM
|
#5
|
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
|
Have you tried using the -loglevel quiet parameter to see if this makes things more acceptable?
|
|
|
01-07-2018, 04:13 PM
|
#6
|
LQ Newbie
Registered: Apr 2014
Distribution: Xubuntu, Arch
Posts: 20
Original Poster
Rep:
|
It just produces less output, in my use case it omits the meta data info for the container.
|
|
|
01-07-2018, 04:21 PM
|
#7
|
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
|
Quote:
Originally Posted by markus-n
It just produces less output, in my use case it omits the meta data info for the container.
|
Ok. If ffprobe is acting in this way then I suggest, in this particular case, that you contact the ffmpeg guys at https://ffmpeg.org/contact.html and ask them if this is normal and, if not, if they would consider changing the behaviour. I would be interested to hear what they say.
|
|
|
All times are GMT -5. The time now is 02:15 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|