|
Author |
Message |
|
|
Posted Jan 10, 2009 at 6:23:16 PM
Subject: Help Needed
I just want to print a last line of output of command during its execution time. Is there a way to do this ?
[b]For example[/b]
$ ./tt.sh /home/JHON/Videos/Ala_sinistra.avi
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.
[i][b]frame= 625 fps=103 q=1.6 size= 12151kB time=24.96 bitrate=3988.0kbit[/i]s/s[/b]
I just want to print the last line which is italic. Can any one help me?
Thanks in Advanced
|
Mr. Shawn H. Corey
Joined Jun 21, 2007 Posts: 2
Other Topics
|
Posted:
Jan 10, 2009 6:33:05 PM
Subject: Help Needed
If you want only the last line, see `man tail`.
|
thobbs
Joined Oct 12, 2008 Posts: 238
Location:Texas!
Other Topics
|
Posted:
Jan 10, 2009 7:05:59 PM
Subject: Help Needed
Specifically, you can pipe the other command into tail. Like such:[code=xml]$ ./tt.sh /home/JHON/Videos/Ala_sinistra.avi | tail -1[/code]The [b]tail -1[/b] indicates that you want to print the last [b]1[/b] line. You could make it any number you want.
|
waqasdaar
Joined Dec 20, 2008 Posts: 34
Other Topics
|
Posted:
Jan 10, 2009 7:27:04 PM
Subject: Help Needed
thanks for your reply
but it does not work. :(
I have tried.
|
waqasdaar
Joined Dec 20, 2008 Posts: 34
Other Topics
|
Posted:
Jan 10, 2009 7:29:54 PM
Subject: Help Needed
frame= 625 fps=103 q=1.6 size= 12151kB time=24.96 bitrate=3988.0kbits
When I execute my script last line continusely changing its value and I just want to print that 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.
any new idea?
|
proopnarine
Joined Apr 03, 2008 Posts: 590
Location:San Francisco
Other Topics
|
Posted:
Jan 11, 2009 4:04:34 AM
Subject: Help Needed
|
thobbs
Joined Oct 12, 2008 Posts: 238
Location:Texas!
Other Topics
|
Posted:
Jan 11, 2009 10:12:36 PM
Subject: Help Needed
I'm not sure exactly what you need, but I think proopnarine is suggesting something like this:[code=xml]./tt.sh /home/JHON/Videos/Ala_sinistra.avi > temp; tail -1 temp[/code]
|
waqasdaar
Joined Dec 20, 2008 Posts: 34
Other Topics
|
Posted:
Jan 12, 2009 4:10:02 PM
Subject: Help Needed
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 -i $1 -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k temp.m2v > temp; tail -1 temp
After that when I run the script
./tt.sh /home/JHON/Videos/Ala_sinistra.avi
It print some thing 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.
[B]frame= 777 fps=102 q=2.0 size= 15120kB time=31.04 bitrate=3990.4kbits/s[/B]
The bold line continusely changing its value after converting the whole media file it prints at the end
[I][B]video:120686kB audio:0kB global headers:0kB muxing overhead 0.000000%[/B][/I]
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.
|
blinky
Joined Jan 08, 2009 Posts: 51
Other Topics
|
Posted:
Jan 12, 2009 5:12:17 PM
Subject: Help Needed
Use the -v option to control the verbosity of the output ("-v 0 " outputs just the last two lines when the command has completed.
You need the redirection, I think ffmpeg uses the standard error stream for it's output
eg.
rc=`ffmpeg -v 0 -i test-media/Atomic_Kitten.mpg /tmp/Atomic_Kitten_1.avi 2>&1 | grep "frame="`
echo $rc
or
ffmpeg -v 0 -i test-media/Atomic_Kitten.mpg /tmp/Atomic_Kitten_1.avi 2>&1 | grep "frame=
In a world without walls and fences, who needs Windows and Gates
|
waqasdaar
Joined Dec 20, 2008 Posts: 34
Other Topics
|
Posted:
Jan 12, 2009 5:44:39 PM
Subject: Help Needed
Thanks brother
I have tried your command but it also prints the whole output, which i dont want that any other idea ?
|
blinky
Joined Jan 08, 2009 Posts: 51
Other Topics
|
Posted:
Jan 12, 2009 7:52:41 PM
Subject: Help Needed
Don't know what your setup is but on Fedora 8, when I run the command
rc=`ffmpeg -v 0 -i test-media/Atomic_Kitten.mpg /tmp/Atomic_Kitten_5.avi 2>&1 | grep "frame="`
echo $rc
in an xterm I only get the frame line
see screen dump [url]http://homepage.ntlworld.com/balbir.sanghera/sc.jpeg[/url]
In a world without walls and fences, who needs Windows and Gates
|