Hello,

Finally, I changed my old Athlon XP2800 + for Intel dual core Sandy.

I'm encoding video with avidemux or ffmpeg - now - with hope to use
real multithreading.

But if I use libavcodec, I can see in "top"  (+H) these threads, but
my CPU is NOT used up to 200%.

1. in avidemux: I see one thread with e.g. 91% cpu and e.g 4 others
with 2-5%.
2. in ffmpeg (with -threads 4 option): I see 4 threads - each with
+-25%

And I can see why too - in "top" I have added column with "last core
used" and the problem is:

ALL THREADS USE in 9/10 cases (showed in top iterations)  the SAME
core.

If I switch off the"H" option in top - the total cpu usage of
avidemux/ffmeg is maximal 143% and both cores have much idle times.

If I compare it with h.264 encoder (in avidemux served with x264 ?)
than both my CPU cores are used totally - up to 200%.  

In top +H I can see +- 5 threads AND !!! - they are in most cases
evenly divided between both cores.

So - why can x264 (?) encoder use multithreading well and libavcodec
 not ?

In attachment are example outputs.

Thanks for suggestions and sorry please my English

--kapetr

P.S.

-system Ubuntu 11.10
- Avidemux 2.5.4
- ffmpeg   0.7.3-4:0.7.3-0ubuntu0.11.10.1
See great IDLE on both CPU cores when using LIBAV encoder and same core used by 
all threads


------------------------------------------
hugo@hugo-A7V400-MX:/media/ext3_sda11$ ffmpeg -i public.ps.mpg -f avi -vcodec 
mpeg4 -b 800k -g 300 -bf 2 -acodec copy -threads 4 public.ps.avi
ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the 
Libav developers
  built on Jan  4 2012 16:21:50 with gcc 4.6.1
  configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' --arch=i386 
--prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx 
--enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc 
--enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared 
--disable-static
  WARNING: library configuration mismatch
  avutil      configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' 
--arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx 
--enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc 
--enable-swscale --enable-x11grab --enable-libdc1394 
--shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static 
--disable-ffmpeg --disable-ffplay
  avcodec     configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' 
--arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx 
--enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc 
--enable-swscale --enable-x11grab --enable-libdc1394 
--shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static 
--disable-ffmpeg --disable-ffplay
  avformat    configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' 
--arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx 
--enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc 
--enable-swscale --enable-x11grab --enable-libdc1394 
--shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static 
--disable-ffmpeg --disable-ffplay
  avdevice    configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' 
--arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx 
--enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc 
--enable-swscale --enable-x11grab --enable-libdc1394 
--shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static 
--disable-ffmpeg --disable-ffplay
  avfilter    configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' 
--arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx 
--enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc 
--enable-swscale --enable-x11grab --enable-libdc1394 
--shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static 
--disable-ffmpeg --disable-ffplay
  swscale     configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' 
--arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx 
--enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc 
--enable-swscale --enable-x11grab --enable-libdc1394 
--shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static 
--disable-ffmpeg --disable-ffplay
  postproc    configuration: --extra-version='4:0.7.3-0ubuntu0.11.10.1' 
--arch=i386 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx 
--enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc 
--enable-swscale --enable-x11grab --enable-libdc1394 
--shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static 
--disable-ffmpeg --disable-ffplay
  libavutil    51.  7. 0 / 51.  7. 0
  libavcodec   53.  6. 0 / 53.  6. 0
  libavformat  53.  3. 0 / 53.  3. 0
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  4. 0 /  2.  4. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  52.  0. 0 / 52.  0. 0
[mpeg @ 0x8e612a0] max_analyze_duration reached
Input #0, mpeg, from 'public.ps.mpg':
  Duration: 00:22:42.20, start: 0.240000, bitrate: 3321 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 64:45 
DAR 16:9], 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
File 'public.ps.avi' already exists. Overwrite ? [y/N] y
[buffer @ 0x8e5c780] w:720 h:576 pixfmt:yuv420p
Output #0, avi, to 'public.ps.avi':
  Metadata:
    ISFT            : Lavf53.3.0
    Stream #0.0: Video: mpeg4, yuv420p, 720x576 [PAR 64:45 DAR 16:9], q=2-31, 
800 kb/s, 25 tbn, 25 tbc
    Stream #0.1: Audio: mp2, 48000 Hz, stereo, 192 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press ctrl-c to stop encoding
[mpeg2video @ 0x8e63200] 00 motion_type at 33 0
[mpeg2video @ 0x8e63200] slice mismatch
[mpeg2video @ 0x8e63200] 00 motion_type at 11 20
[mpeg2video @ 0x8e63200] invalid mb type in P Frame at 10 20
[mpeg2video @ 0x8e63200] invalid cbp at 4 21
[mpeg2video @ 0x8e63200] ac-tex damaged at 1 22
[mpeg2video @ 0x8e63200] 00 motion_type at 16 23
[mpeg2video @ 0x8e63200] 00 motion_type at 1 24
[mpeg2video @ 0x8e63200] 00 motion_type at 5 25
[mpeg2video @ 0x8e63200] ac-tex damaged at 2 26
[mpeg2video @ 0x8e63200] invalid mb type in P Frame at 16 27
[mpeg2video @ 0x8e63200] ac-tex damaged at 6 28
[mpeg2video @ 0x8e63200] ac-tex damaged at 1 29
[mpeg2video @ 0x8e63200] invalid mb type in P Frame at 28 30
[mpeg2video @ 0x8e63200] invalid mb type in P Frame at 11 31
[mpeg2video @ 0x8e63200] invalid mb type in P Frame at 3 32
[mpeg2video @ 0x8e63200] 00 motion_type at 6 33
[mpeg2video @ 0x8e63200] 00 motion_type at 4 34
[mpeg2video @ 0x8e63200] 00 motion_type at 5 35
[mpeg2video @ 0x8e63200] Warning MVs not available
[mpeg2video @ 0x8e63200] concealing 1485 DC, 1485 AC, 1485 MV errors
[mpeg2video @ 0x8e63200] Warning MVs not available54 bitrate= 965.3kbits/s     
[mpeg2video @ 0x8e63200] concealing 40 DC, 40 AC, 40 MV errors
[mpeg2video @ 0x8e63200] ac-tex damaged at 24 6
[mpeg2video @ 0x8e63200] concealing 45 DC, 45 AC, 45 MV errors
^Cframe= 4051 fps=135 q=12.2 Lsize=   19804kB time=162.14 bitrate=1000.5kbits/s 
   
video:15745kB audio:3793kB global headers:0kB muxing overhead 1.357911%
Received signal 2: terminating.
hugo@hugo-A7V400-MX:/media/ext3_sda11$ 


------------------------------------------------------------

Tasks: 354 total,   5 running, 348 sleeping,   0 stopped,   1 zombie
Cpu0  : 72.7%us,  3.7%sy,  0.0%ni, 23.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  : 71.8%us,  4.3%sy,  0.0%ni, 23.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2817528k total,  2297468k used,   520060k free,   109104k buffers
Swap:   530108k total,        0k used,   530108k free,  1502632k cached

  PID USER      PR  NI  VIRT  RES  SHR S P %CPU %MEM    TIME+  COMMAND          
                                
18908 hugo      20   0 69828  18m 2436 R 0 29.9  0.7   0:05.15 ffmpeg -i 
public.ps.mpg -f avi -vcodec mpeg4 -b 8
18906 hugo      20   0 69828  18m 2436 R 0 28.9  0.7   0:05.07 ffmpeg -i 
public.ps.mpg -f avi -vcodec mpeg4 -b 8
18907 hugo      20   0 69828  18m 2436 R 0 28.2  0.7   0:05.11 ffmpeg -i 
public.ps.mpg -f avi -vcodec mpeg4 -b 8
18904 hugo      20   0 69828  18m 2436 S 0 27.9  0.7   0:05.43 ffmpeg -i 
public.ps.mpg -f avi -vcodec mpeg4 -b 8
18905 hugo      20   0 69828  18m 2436 R 0 27.2  0.7   0:04.85 ffmpeg -i 
public.ps.mpg -f avi -vcodec mpeg4 -b 8
 1828 hugo      20   0  585m 219m  33m S 1  2.3  8.0   3:56.83 
/usr/lib/firefox-11.0/firefox                    
 1035 root      20   0 58220  18m  10m S 0  1.7  0.7   3:22.31 /usr/bin/X :0 
-auth /var/run/lightdm/root/:0 -nol
 1636 hugo      20   0  7036 3480 1144 S 0  1.0  0.1   2:23.56 
//bin/dbus-daemon --fork --print-pid 5 --print-ad
 1763 hugo      20   0 10200 3408 2824 S 1  1.0  0.1   0:04.98 
/usr/lib/gvfs/gvfsd-trash --spawner :1.1 /org/gtk
 1703 hugo      20   0 61640  10m 7808 S 0  0.7  0.4   1:02.22 
indicator-multiload                              
 1752 hugo      20   0 80080  20m  10m S 0  0.7  0.7   1:37.46 
/usr/lib/unity/unity-panel-service               
 1671 hugo      20   0  114m  13m  10m S 0  0.3  0.5   0:20.32 metacity         
                                
 1691 hugo      20   0 92896  29m  17m S 0  0.3  1.1   0:18.36 unity-2d-panel   
                                
 1702 hugo      20   0 71600  10m 7980 S 0  0.3  0.4   0:08.49 clipit           
                                
 1756 hugo      20   0 80080  20m  10m S 0  0.3  0.7   0:42.43 
/usr/lib/unity/unity-panel-service               
 1921 hugo      20   0 39352  17m 9748 S 0  0.3  0.6   0:15.16 /usr/bin/python 
/usr/share/system-config-printer/
 1952 hugo      20   0 85568  31m  10m S 0  0.3  1.1   0:10.12 /usr/bin/python 
/usr/lib/ubuntuone-client/ubu

--------------------------------------------------------------------

hugo@hugo-A7V400-MX:~$ top

top - 17:05:16 up  2:52,  3 users,  load average: 0.44, 0.35, 0.18
Tasks: 351 total,   3 running, 347 sleeping,   0 stopped,   1 zombie
Cpu0  : 55.0%us,  2.0%sy,  0.0%ni, 42.1%id,  1.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  : 53.3%us,  1.3%sy,  0.0%ni, 45.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2817528k total,  2252172k used,   565356k free,   109716k buffers
Swap:   530108k total,        0k used,   530108k free,  1515136k cached

  PID USER      PR  NI  VIRT  RES  SHR S P %CPU %MEM    TIME+  COMMAND          
                                
12266 hugo      20   0  320m 148m  16m R 0 89.0  5.4   2:02.11 avidemux2_gtk    
                                
12278 hugo      20   0  320m 148m  16m S 0  3.3  5.4   0:04.92 avidemux2_gtk    
                                
12279 hugo      20   0  320m 148m  16m S 0  3.3  5.4   0:05.10 avidemux2_gtk    
                                
12280 hugo      20   0  320m 148m  16m S 0  3.3  5.4   0:05.05 avidemux2_gtk    
                                
12281 hugo      20   0  320m 148m  16m S 0  3.0  5.4   0:04.89 avidemux2_gtk    
                                
 1035 root      20   0 58376  19m  10m S 1  2.0  0.7   3:30.83 /usr/bin/X :0 
-auth /var/run/lightdm/root/:0 -nol
 1636 hugo      20   0  7036 3480 1144 S 1  1.0  0.1   2:29.47 
//bin/dbus-daemon --fork --print-pid 5 --print-ad
 1828 hugo      20   0  535m 157m  33m S 1  1.0  5.7   4:07.11 
/usr/lib/firefox-11.0/firefox                    
 1703 hugo      20   0 61640  10m 7808 S 1  0.7  0.4   1:04.62 
indicator-multiload                              
 1752 hugo      20   0 80060  20m  10m S 1  0.7  0.7   1:41.37 
/usr/lib/unity/unity-panel-service               
 1756 hugo      20   0 80060  20m  10m S 1  0.7  0.7   0:44.12 
/usr/lib/unity/unity-panel-service               
 1763 hugo      20   0 10200 3408 2824 S 1  0.7  0.1   0:05.34 
/usr/lib/gvfs/gvfsd-trash --spawner :1.1 /org/gtk
 1680 hugo      20   0 95064  30m  17m S 1  0.3  1.1   0:48.35 unity-2d-panel   
                                
 1691 hugo      20   0 95064  30m  17m S 1  0.3  1.1   0:19.08 unity-2d-panel   
                                
 1753 hugo      20   0 80060  20m  10m S 0  0.3  0.7   0:07.03 
/usr/lib/unity/unity-panel-service               
 1842 hugo      20   0  535m 157m  33m S 1  0.3  5.7   0:14.23 
/usr/lib/firefox-11.0/firefox                    
 1952 hugo      20   0 85568  31m  10m S 0  0.3  1.1   0:10.48 /usr/bin/python 
/usr/lib/ubuntuone-client/ubuntuo
 2069 hugo      20   0 79304  16m  11m S 0  0.3  0.6   0:20.19 gnome-terminal   
                                
12270 hugo      20   0  320m 148m  16m R 1  0.3  5.4   0:38.70 avidemux2_gtk    
                                
18881 root      20   0     0    0    0 S 0  0.3  0.0   0:00.13 [kworker/0:1]    
                                
18982 hugo      20   0  2960 1188  884 R 1  0.3  0.0   0:00.04 top              
                    
See NO IDLE on both CPU cores when using X264 (?) encoder and different cores 
used by threads

--------------------------------------------------------------------
hugo@hugo-A7V400-MX:~$ top

top - 17:03:34 up  2:50,  3 users,  load average: 1.12, 0.27, 0.13
Tasks: 356 total,   4 running, 351 sleeping,   0 stopped,   1 zombie
Cpu0  : 19.1%us,  1.3%sy, 75.9%ni,  3.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  : 17.2%us,  1.7%sy, 78.1%ni,  3.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2817528k total,  2253212k used,   564316k free,   109428k buffers
Swap:   530108k total,        0k used,   530108k free,  1501960k cached

  PID USER      PR  NI  VIRT  RES  SHR S P %CPU %MEM    TIME+  COMMAND          
                                
18972 hugo      30  10  344m 162m  16m R 1 52.1  5.9   0:11.83 avidemux2_gtk    
                                
18971 hugo      30  10  344m 162m  16m R 0 51.8  5.9   0:11.69 avidemux2_gtk    
                                
18973 hugo      30  10  344m 162m  16m R 0 51.5  5.9   0:11.98 avidemux2_gtk    
                                
18974 hugo      20   0  344m 162m  16m S 1 19.6  5.9   0:04.63 avidemux2_gtk    
                                
12266 hugo      20   0  344m 162m  16m S 1  7.3  5.9   1:40.67 avidemux2_gtk    
                                
 1035 root      20   0 58352  18m  10m S 0  1.7  0.7   3:28.59 /usr/bin/X :0 
-auth /var/run/lightdm/root/:0 -nol
12278 hugo      20   0  344m 162m  16m S 0  1.3  5.9   0:03.96 avidemux2_gtk    
                                
12280 hugo      20   0  344m 162m  16m S 1  1.3  5.9   0:04.07 avidemux2_gtk    
                                
 1636 hugo      20   0  7036 3480 1144 S 0  1.0  0.1   2:27.80 
//bin/dbus-daemon --fork --print-pid 5 --print-ad
 1828 hugo      20   0  535m 156m  33m S 0  1.0  5.7   4:05.31 
/usr/lib/firefox-11.0/firefox                    
12279 hugo      20   0  344m 162m  16m S 0  1.0  5.9   0:04.12 avidemux2_gtk    
                                
12281 hugo      20   0  344m 162m  16m S 0  1.0  5.9   0:03.92 avidemux2_gtk    
                                
 1752 hugo      20   0 80172  20m  10m S 0  0.7  0.7   1:40.38 
/usr/lib/unity/unity-panel-service               
12270 hugo      20   0  344m 162m  16m S 1  0.7  5.9   0:37.98 avidemux2_gtk    
                                
 1671 hugo      20   0  114m  13m  10m S 0  0.3  0.5   0:20.91 metacity         
                                
 1703 hugo      20   0 61640  10m 7808 S 0  0.3  0.4   1:04.03 
indicator-multiload                              
 1756 hugo      20   0 80172  20m  10m S 0  0.3  0.7   0:43.71 
/usr/lib/unity/unity-panel-service               
 1763 hugo      20   0 10200 3408 2824 S 1  0.3  0.1   0:05.12 
/usr/lib/gvfs/gvfsd-trash --spawner :1.1 /org/gtk
 2069 hugo      20   0 79080  16m  11m S 1  0.3  0.6   0:19.86 gnome-terminal   
            
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to