dimanche 29 août 2010
FFmpeg: Performance de conversion pour WebM et nombre de CPU
Par david techer, dimanche 29 août 2010 à 16:52 :: Multiméda sous GNU/Linux
On dispose pour ce test
- d'une petite machine avec Processeur Intel Core 2 Quad Q8200
- d'une version de ffmpeg compilée avec WebM
Test normal
On lance dans un script shell le contenubegin_times=`date '+%s'`; time /opt/multimedia-prod/bin/ffmpeg -y -i janadefi-daywith03.wmv -f webm -vcodec libvpx janadefi-daywith03.webm; end_times=`date '+%s'`;duration_times=`expr $end_times - $begin_times`; echo "Ecoulement approximatif de $duration_times secondes..."On exécute le script. Pendant la converson, on lance depuis un autre shell
top -p $(pidof ffmpeg) top - 16:45:13 up 6 days, 16:48, 2 users, load average: 0.89, 0.61, 0.48 Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie Cpu0 : 0.3%us, 0.7%sy, 0.3%ni, 98.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu1 :100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu2 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu3 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 3115472k total, 3022124k used, 93348k free, 252360k buffers Swap: 9124880k total, 137516k used, 8987364k free, 1991428k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 28815 root 20 0 42496 19m 3136 R 100 0.7 1:51.73 ffmpegCe qui se solde par
FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers built on Aug 16 2010 21:38:36 with gcc 4.3.2 configuration: --prefix=/opt/multimedia --enable-libvpx --enable-libdirac --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libfaad --enable-libfaadbin --enable-libfaac --enable-gpl --enable-nonfree --enable-pthreads --extra-cflags='-I$TOOLS_MULTIMEDIA_DIR/include/ -I$TOOLS_MULTIMEDIA_DIR/include/a52dec/ -I$TOOLS_MULTIMEDIA_DIR/include/lame/ -I$TOOLS_MULTIMEDIA_DIR/include/ -I$TOOLS_MULTIMEDIA_DIR/include/ao -I$TOOLS_MULTIMEDIA_DIR/include/libyasm -I$TOOLS_MULTIMEDIA_DIR/include/ogg -I$TOOLS_MULTIMEDIA_DIR/include/SDL -I$TOOLS_MULTIMEDIA_DIR/include/speex -I$TOOLS_MULTIMEDIA_DIR/include/vorbis -I$TOOLS_MULTIMEDIA_DIR/include/theora -I$TOOLS_MULTIMEDIA_DIR/include/schroedinger-1.0 -I$TOOLS_MULTIMEDIA_DIR/include/dirac -I$TOOLS_MULTIMEDIA_DIR/include/opencore-amrnb/ -I$TOOLS_MULTIMEDIA_DIR/include/opencore-amrwb/ -I/opt/multimedia/include/vpx' --extra-ldflags=-L/opt/multimedia/lib libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0.11. 0 / 0.11. 0 [wmv3 @ 0x92b8760]Extra data: 8 bits left, value: 0 Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.97 (30000/1001) Input #0, asf, from 'janadefi-daywith03.wmv': Metadata: WM/ToolName : Flip4Mac WMV Export Component for QuickTime (Mac) WM/ToolVersion : 2326馀á€ë‘·æ«´æ«°åˆ¸ë–¶ï€¸æ«°å˜˜ã¤²ê¦ ꦰíŽï¢¿ì°©éš¨Ö„æ«° title : author : copyright : comment : Duration: 00:06:08.03, start: 5.000000, bitrate: 3999 kb/s Stream #0.0: Audio: wmav2, 44100 Hz, 2 channels, s16, 64 kb/s Stream #0.1: Video: wmv3, yuv420p, 640x480, 29.97 tbr, 1k tbn, 1k tbc [libvpx @ 0x92ba250]v0.9.1 [wmv3 @ 0x92b8760]Extra data: 8 bits left, value: 0 Output #0, webm, to 'janadefi-daywith03.webm': Metadata: encoder : Lavf52.64.2 Stream #0.0: Video: libvpx, yuv420p, 640x480, q=2-31, 200 kb/s, 1k tbn, 29.97 tbc Stream #0.1: Audio: libvorbis, 44100 Hz, 2 channels, s16, 64 kb/s Stream mapping: Stream #0.1 -> #0.0 Stream #0.0 -> #0.1 Press [q] to stop encoding frame=11035 fps= 29 q=0.0 Lsize= 18911kB time=368.20 bitrate= 420.8kbits/s video:15810kB audio:2881kB global headers:3kB muxing overhead 1.160188% real 6m26.927s user 6m26.480s sys 0m0.360s Ecoulement approximatif de 387 secondes...
Test avec nombre cpu=4
Cette fois-ci, on précise le paramètre threads fixé à 4begin_times=`date '+%s'`; time /opt/multimedia-prod/bin/ffmpeg -y -i janadefi-daywith03.wmv -threads 4 -f webm -vcodec libvpx janadefi-daywith03.webm; end_times=`date '+%s'`;duration_times `expr $end_times - $begin_times`; echo "Ecoulement approximatif de $duration_times secondes..."On surveille la répartition
root@monroe:~# top -p $(pidof ffmpeg) top - 16:57:51 up 6 days, 17:01, 2 users, load average: 1.28, 0.71, 0.56 Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie Cpu0 : 19.3%us, 4.1%sy, 0.0%ni, 76.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu1 : 21.8%us, 0.7%sy, 0.0%ni, 77.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu2 : 33.5%us, 1.9%sy, 0.0%ni, 64.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu3 : 74.5%us, 1.0%sy, 0.0%ni, 24.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 3115472k total, 3017096k used, 98376k free, 254076k buffers Swap: 9124880k total, 137568k used, 8987312k free, 1985200k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 28942 root 20 0 129m 20m 3164 R 159 0.7 4:14.33 ffmpegOn obtient à la fin
FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers built on Aug 16 2010 21:38:36 with gcc 4.3.2 configuration: --prefix=/opt/multimedia --enable-libvpx --enable-libdirac --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-libx264 --enable-libxv d --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libfaad --enable-libfaadbin --enable-libfaac --enable-gpl --enable-nonfree --enable-pthreads --extra-cflags='-I$TOOLS_MULTIME IA_DIR/include/ -I$TOOLS_MULTIMEDIA_DIR/include/a52dec/ -I$TOOLS_MULTIMEDIA_DIR/include/lame/ -I$TOOLS_MULTIMEDIA_DIR/include/ -I$TOOLS_MULTIMEDIA_DIR/include/ao -I$TOOLS_MULTIMEDIA_DIR/include/libyasm -I$TOO S_MULTIMEDIA_DIR/include/ogg -I$TOOLS_MULTIMEDIA_DIR/include/SDL -I$TOOLS_MULTIMEDIA_DIR/include/speex -I$TOOLS_MULTIMEDIA_DIR/include/vorbis -I$TOOLS_MULTIMEDIA_DIR/include/theora -I$TOOLS_MULTIMEDIA_DIR/inc ude/schroedinger-1.0 -I$TOOLS_MULTIMEDIA_DIR/include/dirac -I$TOOLS_MULTIMEDIA_DIR/include/opencore-amrnb/ -I$TOOLS_MULTIMEDIA_DIR/include/opencore-amrwb/ -I/opt/multimedia/include/vpx' --extra-ldflags=-L/opt multimedia/lib libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0.11. 0 / 0.11. 0 [wmv3 @ 0x92b8760]Extra data: 8 bits left, value: 0 Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.97 (30000/1001) Input #0, asf, from 'janadefi-daywith03.wmv': Metadata: WM/ToolName : Flip4Mac WMV Export Component for QuickTime (Mac) WM/ToolVersion : 2326馀á€ë‘·æ«´æ«°åˆ¸ë–¶ï€¸æ«°å˜˜ã¤²ê¦ ꦰíŽï¢¿ì°©éš¨Ö„æ«° title : author : copyright : comment : Duration: 00:06:08.03, start: 5.000000, bitrate: 3999 kb/s Stream #0.0: Audio: wmav2, 44100 Hz, 2 channels, s16, 64 kb/s Stream #0.1: Video: wmv3, yuv420p, 640x480, 29.97 tbr, 1k tbn, 1k tbc [libvpx @ 0x92ba250]v0.9.1 [wmv3 @ 0x92b8760]Extra data: 8 bits left, value: 0 Output #0, webm, to 'janadefi-daywith03.webm': Metadata: encoder : Lavf52.64.2 Stream #0.0: Video: libvpx, yuv420p, 640x480, q=2-31, 200 kb/s, 1k tbn, 29.97 tbc Stream #0.1: Audio: libvorbis, 44100 Hz, 2 channels, s16, 64 kb/s Stream mapping: Stream #0.1 -> #0.0 Stream #0.0 -> #0.1 Press [q] to stop encoding frame=11035 fps= 42 q=0.0 Lsize= 18917kB time=368.20 bitrate= 420.9kbits/s video:15815kB audio:2881kB global headers:3kB muxing overhead 1.159740% real 4m19.877s user 6m49.020s sys 0m19.650s Ecoulement approximatif de 260 secondes...