LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-12-2009, 11:03 AM   #16
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,767

Rep: Reputation: 2613Reputation: 2613Reputation: 2613Reputation: 2613Reputation: 2613Reputation: 2613Reputation: 2613Reputation: 2613Reputation: 2613Reputation: 2613Reputation: 2613

Quote:
Originally Posted by waqasdaar View Post
I am using "ffmpeg" which is a command line tool to convert multimedia files between formats. In a script (tt.sh) i am using the ffmpeg comand like this

Sorry guys if I didnot mention the problem clearly.
No, we all understand the question. You are not reading the answers that are given. Your problem has been well-solved by the above posters, but you (still) haven't said what commands you're running that don't work, the sample script you've supposedly written, or given any feedback on the information you were directed to.
  1. Read the man page for the tail command. Look at the different options, and see which one fits your need. There is one.
  2. STDOUT and STDERR were referenced...research how to use them in a script. Lots of information out there
  3. POST YOUR SCRIPT

Do these things mentioned above, before posting back about how it doesn't work, and asking the same question again.
 
Old 01-12-2009, 01:14 PM   #17
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by waqasdaar View Post
...
The bold line continusely changing its value after converting the whole media file it prints at the end

video:120686kB audio:0kB global headers:0kB muxing overhead 0.000000%

I just trying to achieve that it only prints the Bold line. after it finish script return me the control back. Hope now you understand the problem.

Sorry guys if I didnot mention the problem clearly.


Thanks in Advanced.
OK, so here is a number of questions for you:

  1. Is the bold line in the you see in the terminal the same from the point of view of characters it contains as a line in a text file ?
  2. Is the bold line you see printed to stdout or stderr ?

Try to understand/answer these two questions first - in whatever order.

Maybe start from the simpler one - about stderr vs stdout - do you know how to find this out ?

Do you understand why these questions are asked ?
 
Old 01-12-2009, 02:44 PM   #18
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,013

Rep: Reputation: 83
As previously mentioned by PTrenholme and indicated by others, you need to understand output redirection.

In a shell, type man bash and read the section on REDIRECTION.

The output you are getting is from stderr instead of stdout

When you redirect output using the > without a file descriptor, bash assumes that you mean stdout (File descriptor 1).

Therefore:
Code:
ffmpeg -i $1 -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k temp.m2v > temp
is the same as:
Code:
ffmpeg -i $1 -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k temp.m2v 1> temp
What you could do is redirect stderr (File descriptor 2):
Code:
ffmpeg -i $1 -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k temp.m2v 1> temp 2> errors
I suspect (as does everyone else who has posted a response) that the line you are after is the last line of the new errors file.

If you look at my previous post you would see something like:
Code:
2>&1
What this is saying is, redirect stderr to stdout (which is being redirected to the file temp.

What we have been saying, is that it is in your best interest to understand this as opposed to copy typing.

Last edited by Disillusionist; 01-12-2009 at 02:46 PM.
 
  


Reply

Tags
bash, scripting


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent help needed! Please!!! RobynD Linux - Newbie 6 11-03-2007 10:29 AM
Urgent - Help Needed rigel_kent Linux - General 1 07-21-2005 08:20 AM
Please Urgent Help Needed Here !!! dezeque Linux - General 6 05-26-2005 03:37 PM
Urgent help needed the_twister Linux - Security 4 08-13-2003 09:58 AM
Urgent help needed J_Szucs Linux - Newbie 7 07-09-2002 09:39 AM


All times are GMT -5. The time now is 07:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration