LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-27-2009, 06:13 AM   #1
JavaNinja
Member
 
Registered: Sep 2008
Posts: 90

Rep: Reputation: 15
FFmpeg - CPU load and error_log


Hi

When I use the top command I see FFmpeg using 98.5% under the CPU column and then when I go to my webmin homepage, it shows this:

Code:
CPU load averages 	0.21 (1 min) 0.15 (5 mins) 0.10 (15 mins)
Are these not contradictory or have I not understood the top command?

Also FFmpeg seems to always save its output to /var/log/httpd/error_log even though it works fine, its probably showing warnings. How do I sop ffmpeg from sending output there? The file is huge!

Code:
-rw-r--r-- 1 root root  60757680 2009-02-27 12:09 error_log
I guess I can redirect output somewhere else. How is this done? Is it add "> dev/null" after ffmpeg commands that are executed?

Thanks all for any help
 
Old 02-27-2009, 11:19 AM   #2
shakezilla
Member
 
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78

Rep: Reputation: 16
Are you running ffmpeg from cgi or something? That's normally the only way that ffmpeg would be outputting to that logfile.
 
Old 02-27-2009, 05:59 PM   #3
JavaNinja
Member
 
Registered: Sep 2008
Posts: 90

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by shakezilla View Post
Are you running ffmpeg from cgi or something? That's normally the only way that ffmpeg would be outputting to that logfile.
Yes, I am making the command call via PHP, so I can just pipe output to /dev/null?

What do you think of the CPU usage of ffmpeg? Is it normal? In some cases 5-10 instances of ffmpeg will run but surely that shouldn't reach 90% CPU usage. AND Webmin does not record this level of usage why?
 
Old 02-27-2009, 07:19 PM   #4
shakezilla
Member
 
Registered: Jun 2005
Location: U.S.
Distribution: xubuntu 8.10, linux 2.6.27-11-generic
Posts: 78

Rep: Reputation: 16
Here is some info on io redirection:
http://tldp.org/LDP/abs/html/io-redirection.html

What you're looking for is 2> as this will redirect stderr. If you just want to turn it off for now then do this in your command call:
Code:
ffmpeg blah blah blah   2>/dev/null
It's important for you to know that this isn't fixing the errors, it's just ignoring them. You need to figure out why ffmpeg is outputting so much and fix the root of the problem.

As far as cpu usage, yes, ffmpeg is quite capable of taking up a lot, depending on what you're doing with it. Working with video can be very resource intensive, so don't be surprised when it slows things down. This is why it's probably smarter to not try to do your video processing in realtime.
 
Old 02-28-2009, 08:00 AM   #5
JavaNinja
Member
 
Registered: Sep 2008
Posts: 90

Original Poster
Rep: Reputation: 15
Ah ok, got it. Thanks shakezilla.

The following is part of the entry made in the /var/log/httpd/error_log. As you can see its the normal output and that file is full of ffmpegs normal output. Maybe it goes in there because of the warnings that ffmpeg makes about the "output buffer too small"?

Code:
   Stream #0.0: Video: flv, yuv420p, 320x240, 25.00 tb(r)
    Stream #0.1: Audio: mp3, 22050 Hz, mono, s16, 64 kb/s
Output #0, mp3, to '/var/www/html/audio/ku41u0td365v2lv0usghj9sc751235825593.mp3':
    Stream #0.0: Audio: libmp3lame, 22050 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0.1 -> #0.0
Press [q] to stop encoding
[libmp3lame @ 0x8215390]lame: output buffer too small (buffer index: 8150, free bytes: 490)
size=    1605kB time=205.45 bitrate=  64.0kbits/s
video:0kB audio:1605kB global headers:0kB muxing overhead 0.001947%
 
Old 02-28-2009, 08:21 AM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
That output seems to show that the problem is more with libmp3lame than with ffmpeg. Perhaps the rather low audio bitrate and samplerate have something to do with it. Then again, it could be a bug either in liblame or in the way ffmpeg communicates with it.

I suggest trying some tests. Try encoding to a different format, such as mp2, aac, or ogg. Also try encoding a .wav file with lame directly, using both the same settings, and more normal ones (e.g. 44100 samplerate) and see if you get similar errors.
 
Old 02-28-2009, 08:36 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,045

Rep: Reputation: 1914Reputation: 1914Reputation: 1914Reputation: 1914Reputation: 1914Reputation: 1914Reputation: 1914Reputation: 1914Reputation: 1914Reputation: 1914Reputation: 1914
Quote:
Originally Posted by JavaNinja View Post
Are these not contradictory or have I not understood the top command?
It's more likely you've not understood loadavg.
Has nothing to do (directly) with CPU usage - it's the average number of tasks in the runq plus those in uninterruptable sleep.
 
Old 02-28-2009, 09:30 AM   #8
JavaNinja
Member
 
Registered: Sep 2008
Posts: 90

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by David the H.
That output seems to show that the problem is more with libmp3lame than with ffmpeg
You are correct, I have searched around and some of the suggestions from other mailing lists in the past was to upgrade libmp3lame and I have done so but it still persists. I am sure it is a libmp3lame problem but don't know how to fix it. Lucky its not that critical and it at least does convert. But i still need to fix it!

Quote:
Originally Posted by syg00
It's more likely you've not understood loadavg.
Has nothing to do (directly) with CPU usage - it's the average number of tasks in the runq plus those in uninterruptable sleep.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4391 apache 20 0 26772 7280 2892 R 84.9 0.4 0:02.55 ffmpeg

You are right, I might not have understood correctly. In the above case, I assumed that ffmpeg is making 84.9% usage of the CPU at that instant in time. Please correct me.

Last edited by JavaNinja; 02-28-2009 at 09:31 AM.
 
  


Reply


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
Help me in installing ffmpeg, ffmpeg-PHP, Mplayer, Mencoder, flv2tool, LAME MP3 Encod mitesh.ever Red Hat 5 05-16-2009 01:14 PM
Does the latest version of ffmpeg not work with ffmpeg-php? whitey4900 Linux - Software 0 08-04-2008 06:16 PM
Generate alert with "CPU load average" "CPU utilization" viky Linux - Hardware 3 07-25-2007 05:24 AM
strange cpu load mindcry Linux - Software 4 08-07-2004 12:57 AM
Question about CPU load iceman47 Linux - Hardware 8 05-29-2003 10:04 AM


All times are GMT -5. The time now is 01:11 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration