2015-06-12 75 views
0

我最近更新了ffmpeg從2.0.2版到最新版本2.7。我使用與舊版本和相同編解碼器版本(libvpx和h264)相同的構建配置來安裝它。當我試圖將mp4視頻轉碼爲webm時,我發現新版本的速度比舊版本低很多(3倍)。我在兩臺相同的8核心機器上運行(Intel(R)Xeon(R)CPU E5-2680 v2 @ 2.80GHz) - 操作系統:Ubuntu 14.04。下面是命令我運行:當轉碼到webm時Ffmpeg性能問題

/usr/local/bin/ffmpeg -i in.mp4 -f webm -vcodec libvpx -b:v 1000K out.webm 

這些是兩個版本的輸出:

v 2.0.2

ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers 
built on Jan 7 2015 13:51:25 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) 
configuration: --disable-ffplay --disable-ffserver --enable-libxvid --enable-gpl --enable-nonfree --enable-pthreads --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-zlib --enable-avfilter --enable-libfreetype --enable-libfdk_aac --enable-libtheora --enable-libvorbis --enable-libvpx --enable-pic --enable-shared 
libavutil  52. 38.100/52. 38.100 
libavcodec  55. 18.102/55. 18.102 
libavformat 55. 12.100/55. 12.100 
libavdevice 55. 3.100/55. 3.100 
libavfilter  3. 79.101/3. 79.101 
libswscale  2. 3.100/2. 3.100 
libswresample 0. 17.102/0. 17.102 
libpostproc 52. 3.100/52. 3.100 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4': 
Metadata: 
major_brand  : isom 
minor_version : 512 
compatible_brands: isomiso2avc1mp41 
encoder   : Lavf55.12.100 
Duration: 00:00:10.19, start: 0.000000, bitrate: 1724 kb/s 
Stream #0:0(und): Video: h264 (Main) (avc1/0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1480 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc 
Metadata: 
    handler_name : VideoHandler 
Stream #0:1(und): Audio: aac (mp4a/0x6134706D), 44100 Hz, stereo, fltp, 253 kb/s 
Metadata: 
    handler_name : SoundHandler 
[libvpx @ 0x22f3760] v1.3.0 
Output #0, webm, to 'out.webm': 
Metadata: 
major_brand  : isom 
minor_version : 512 
compatible_brands: isomiso2avc1mp41 
encoder   : Lavf55.12.100 
Stream #0:0(und): Video: vp8 (libvpx), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 1000 kb/s, 1k tbn, 29.97 tbc 
Metadata: 
    handler_name : VideoHandler 
Stream #0:1(und): Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp 
Metadata: 
    handler_name : SoundHandler 
Stream mapping: 
Stream #0:0 -> #0:0 (h264 -> libvpx) 
Stream #0:1 -> #0:1 (aac -> libvorbis) 
Press [q] to stop, [?] for help 
frame= 302 fps= 23 q=0.0 Lsize= 1445kB time=00:00:10.18 bitrate=1161.9kbits/s  
video:1304kB audio:128kB subtitle:0 global headers:4kB muxing overhead 0.644833% 

v 2.7

ffmpeg version 2.7 Copyright (c) 2000-2015 the FFmpeg developer built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) 
    configuration: --disable-ffplay --disable-ffserver --enable-libxvid --enable-gpl --enable-nonfree --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-zlib --enable-libass --enable-pthreads --enable-avfilter --enable-libfreetype --enable-libfdk_aac --enable-libtheora --enable-libvorbis --enable-libvpx --enable-pic --enable-shared --enable-openssl 
    libavutil  54. 27.100/54. 27.100 
    libavcodec  56. 41.100/56. 41.100 
    libavformat 56. 36.100/56. 36.100 
    libavdevice 56. 4.100/56. 4.100 
    libavfilter  5. 16.101/5. 16.101 
    libswscale  3. 1.101/3. 1.101 
    libswresample 1. 2.100/1. 2.100 
    libpostproc 53. 3.100/53. 3.100 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4': 
    Metadata: 
    major_brand  : isom 
    minor_version : 512 
    compatible_brands: isomiso2avc1mp41 
    encoder   : Lavf56.36.100 
    Duration: 00:00:10.19, start: 0.000000, bitrate: 1596 kb/s 
    Stream #0:0(und): Video: h264 (Main) (avc1/0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1480 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default) 
    Metadata: 
     handler_name : VideoHandler 
    Stream #0:1(und): Audio: aac (LC) (mp4a/0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) 
    Metadata: 
     handler_name : SoundHandler 
[libvpx @ 0xfe4640] v1.3.0 
Output #0, webm, to 'out.webm': 
    Metadata: 
    major_brand  : isom 
    minor_version : 512 
    compatible_brands: isomiso2avc1mp41 
    encoder   : Lavf56.36.100 
    Stream #0:0(und): Video: vp8 (libvpx), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 1000 kb/s, 29.97 fps, 1k tbn, 29.97 tbc (default) 
    Metadata: 
     handler_name : VideoHandler 
     encoder   : Lavc56.41.100 libvpx 
    Stream #0:1(und): Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp (default) 
    Metadata: 
     handler_name : SoundHandler 
     encoder   : Lavc56.41.100 libvorbis 
Stream mapping: 
    Stream #0:0 -> #0:0 (h264 (native) -> vp8 (libvpx)) 
    Stream #0:1 -> #0:1 (aac (native) -> vorbis (libvorbis)) 
Press [q] to stop, [?] for help 
frame= 302 fps=8.3 q=0.0 Lsize= 1410kB time=00:00:10.18 bitrate=1133.4kbits/s  
video:1274kB audio:123kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.909304% 

我試過的ffmpeg 2.6.3和性能與2.7相同。此外,它看起來像當我轉碼webM到mp4 2.7比webm快30%。

我試圖看看是否有新版本的構建配置選項,但找不到任何東西。

任何人都可以提出一個可能的原因,當轉碼到webm時,新版本的速度更差的性能?

回答

1

我使用-loglevel 99運行該命令,並檢查了日誌。我發現在VPX編解碼器選項的差異:

V2.0.2:

[libvpx @ 0x1e18780] vpx_codec_control 
[libvpx @ 0x1e18780] VP8E_SET_CPUUSED: 3 

V2.7:

[libvpx @ 0x1e18780] vpx_codec_control 
[libvpx @ 0x1e18780] VP8E_SET_CPUUSED: 1 

它看起來像通過的ffmpeg套這個新版本1默認。要從ffmpeg手動設置此參數,我必須添加選項:「-speed」。該選項的描述位於http://www.webmproject.org/docs/webm-sdk/group__vp8__encoder.html。我在ffmpeg開發人員郵件列表中找到了速度選項的參考:http://ffmpeg.org/pipermail/ffmpeg-devel/2011-January/105630.html。使用命令:

/usr/local/bin/ffmpeg -i in.mp4 -f webm -vcodec libvpx -b:v 1000K -speed 3 out.webm 

我在ffmpeg 2.0.2和2.7中獲得了相同的性能。 我試圖提高價值,我實現了顯着的速度提升。從視覺評估來看,質量似乎是由b:v選項(比特率)來保證的。