ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
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.
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 25.00 (25/1)
Input #0, avi, from '/home/waqasdaar/Videos/Ala_sinistra.avi':
Duration: 00:04:07.28, start: 0.000000, bitrate: 754 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 25.00 tb(r)
Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 160 kb/s
File 'temp.m2v' already exists. Overwrite ? [y/N] y
Output #0, mpeg2video, to 'temp.m2v':
Stream #0.0: Video: mpeg2video, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 4000 kb/s, 25.00 tb(c)
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
Compiler did not align stack variables. Libavcodec has been miscompiled
and may be very slow or crash. This is not a bug in libavcodec,
but in the compiler. You may try recompiling using gcc >= 4.2.
Do not report crashes to FFmpeg developers. frame= 625 fps=103 q=1.6 size= 12151kB time=24.96 bitrate=3988.0kbits
I just want to print the last line which is bold. Can any one help me?
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
Rep:
Piping output to tail with the option set for tail to output only the last line should work. You could use awk for this but really tail is the way to go.
When I execute my script last line continusely changing its value and I just want to print that, even I tried all method its does nor work with 'tail' command. Even I have tried with 'sed', tried to only print the line starting with 'frame='
but it also does not work.
waqasdaar, you've fallen into a "Linux mindset" trap. (This is almost as bad as falling amongst thieves, but, I hope, not quite.)
You posted a (poorly titled) query in the programming forum which, to most of us, implies either that you are, or that you wish to be, knowledgeable about programming, but don't know how to proceed. Therefore the advice you're getting is focused on helping you learn "The Linux Way," not a specific answer to your question.
Your question was, in fact, answered by the first response where you were directed to read the manual explaining the use of the tail command. The mind set here is that simply saying "add 2>&1 | tail -1 at the end of the command" is, to quote from the old parable, "giving you a fish" whilst saying "man tail" is "teaching you how to fish."
The additional reading to understand the 2>&1 and "|" is found in info bash, which also covers much other useful shell scripting information. Unless your shell command (tt.sh) is generating output to stderr, the 2>1& prior to the pipe (|) is unnecessary.
waqasdaar, you've fallen into a "Linux mindset" trap. (This is almost as bad as falling amongst thieves, but, I hope, not quite.)
You posted a (poorly titled) query in the programming forum which, to most of us, implies either that you are, or that you wish to be, knowledgeable about programming, but don't know how to proceed. Therefore the advice you're getting is focused on helping you learn "The Linux Way," not a specific answer to your question.
Your question was, in fact, answered by the first response where you were directed to read the manual explaining the use of the tail command. The mind set here is that simply saying "add 2>&1 | tail -1 at the end of the command" is, to quote from the old parable, "giving you a fish" whilst saying "man tail" is "teaching you how to fish."
The additional reading to understand the 2>&1 and "|" is found in info bash, which also covers much other useful shell scripting information. Unless your shell command (tt.sh) is generating output to stderr, the 2>1& prior to the pipe (|) is unnecessary.
I think I know what the OP's problem is, but, as you said, I'd like to see some indication that he/she really wants to learn how to catch fish and not only how to eat it.
This doesn't tell anything useful.
Post how exactly you tried it (i.e. complete command) and how exactly it didn't work (what you expected, and what you've got).
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
FFmpeg version git-5a82e37, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration:
libavutil 49.12. 0 / 49.12. 0
libavcodec 52. 3. 0 / 52. 3. 0
libavformat 52.23. 1 / 52.23. 1
libavdevice 52. 1. 0 / 52. 1. 0
built on Nov 17 2008 15:13:29, gcc: 3.3.5 (Debian 1:3.3.5-13)
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 25.00 (25/1)
Input #0, avi, from '/home/waqasdaar/Videos/Ala_sinistra.avi':
Duration: 00:04:07.28, start: 0.000000, bitrate: 754 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 25.00 tb(r)
Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 160 kb/s
File 'temp.m2v' already exists. Overwrite ? [y/N] Y
Output #0, mpeg2video, to 'temp.m2v':
Stream #0.0: Video: mpeg2video, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 4000 kb/s, 25.00 tb(c)
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
Compiler did not align stack variables. Libavcodec has been miscompiled
and may be very slow or crash. This is not a bug in libavcodec,
but in the compiler. You may try recompiling using gcc >= 4.2.
Do not report crashes to FFmpeg developers. frame= 777 fps=102 q=2.0 size= 15120kB time=31.04 bitrate=3990.4kbits/s
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.