[FFmpeg-devel] encoding to multiple cores with mpeg4

Dion Galbreath DionG
Tue Oct 14 21:07:41 CEST 2008

-----Original Message-----
From: ffmpeg-devel-bounces at mplayerhq.hu
[mailto:ffmpeg-devel-bounces at mplayerhq.hu] On Behalf Of Daniel Taylor
Sent: Tuesday, October 14, 2008 1:50 PM
To: FFmpeg development discussions and patches
Subject: Re: [FFmpeg-devel] encoding to multiple cores with mpeg4


On 14 Oct, 2008, at 19:15, Dion Galbreath wrote:
> I tried asking this in libavusers but there doesn't seem to be much
> traffic there.. so

Definitely the wrong list. Try ffmpeg-user!

> Can ffmpeg evenly distribute the work on 8 cores? I seem to only be  
> able
> to get it to evenly spread out on 2 cores, and a 3rd does a little bit
> of work while the remainder cores seem silent.  I am encoding to  
> mpeg4,
> and aac.  Is there some settings I can use to make the mpeg4 encoding
> work load thread to all 8 cores???

There is work currently in progress (I think it is still being done)  
for frame-based multithreading throughout ffmpeg so that all codecs  
can use multiple cores, but at the moment it must be implemented per- 
codec. I don't believe the mpeg4-asp encoder supports it, but encoding  
mpeg4-avc (h.264) with libx264 allows you to use any number of cores  
so you might want to look into that. To get it to automatically use  
all cores I believe you can pass -threads 0.

Good luck,
Daniel G. Taylor

I was able to get h264 using pthreads to us all 8 cores. However in
mpeg4 it wouldn't use more then 2.  I tried with pthreads and mpeg4 and
saw it would only use 2 cores. Compiled without pthreads to use ffmpegs
threading, and it was still stuck at 2 cores.. .. .  is the -threads x
the same as putting thread_count = x in code? I would imagine so.. from
what I learned the golden rule for that is don't set it to something
higher then the amount of cores you have. So I set it anywhere from 0 to
8 and got the same issues. For an odd test I set to like 16 for a I
wonder what will happen moment..  didn't matter still same results. So
it makes me wonder if its broken for mpeg4  CODEC_ID_MPEG4,


ffmpeg-devel mailing list
ffmpeg-devel at mplayerhq.hu

More information about the ffmpeg-devel mailing list