As FFmpeg-mt was integrated into main branch I decided to send my question
to this mail list.
I ask for help to understand how and where I can get benefits from
multithreading decoding.
Yesterday I turned back to FFmpeg-mt project again (I not yet get update
from main FFmpeg branch).
I test some problematic video on old FFmpeg-mt build for Linux
and notice that it 'works' for me first time ;) (I can not do that before).
I got 16-18FPS instead of 10-12FPS on my Phenom II x2 550 and CPU
utilization was almost 100% (all cores).
Not fast enough (target was 30FPS) but better than without.
I update the sources from GIT repository for FFmpeg-mt and build version for
Windows.
Here the configuration:
FFmpeg version git-4118a72, Copyright (c) 2000-2011 the FFmpeg developers
built on Mar 24 2011 01:25:31 with gcc 4.4.2
configuration: --enable-swscale --enable-shared --disable-static
--enable-memalign-hack --enable-avfilter --enable-hardcoded-tables
--disable-libopenjpeg --enable-runtime-cpudetect --enable-w32threads
--enable-avisynth --enable-cross-compile --target-os=mingw32
--cross-prefix=i686-mingw32- --arch=x86_32 --disable-debug --enable-version3
libavutil 50. 39. 0 / 50. 39. 0
libavcodec 52.113. 2 / 52.113. 2
libavformat 52.102. 0 / 52.102. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1. 76. 0 / 1. 76. 0
libswscale 0. 12. 0 / 0. 12. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]
outfile}...
>
I build it for both x86 and x86_64 architectures. Notice that my
configuration is a LGPL one. Do the -mt features
available only under GPL license?
But when I checked the performance on my work machine (Athlon II X4 640, 4
cores) I notices that there
no any difference with the old FFmpeg libraries (no -mt) in both measures -
CPU utilization and result FPS.
I think that I may be doing something wrong and ask you for help.
This time I initialize multithreading like this:
// find the decoder for the video stream
codec = avcodec_find_decoder(codecCtx->codec_id);
if(codec == NULL) {
stError(ST_TEXT("FFmpeg: Video codec not found"));
deinit();
return false;
}
// configure the codec
int threadsCount = StThread::countLogicalProcessors();
codecCtx->thread_count = threadsCount;
avcodec_thread_init(codecCtx, threadsCount);
ST_DEBUG_LOG("FFmpeg: Setup AVcodec to use " + threadsCount + "
threads");
// open VIDEO codec
if(avcodec_open(codecCtx, codec) < 0) {
stError(ST_TEXT("FFmpeg: Could not open video codec"));
deinit();
return false;
}
In case of my workstation it is 4 threads.
Not sure how multithreading support works in the decoder but I tried to
measure the avcodec_decode_video() function
(I yet use the old deprecated one for ABI compatiblity) and get almost same
times for FFmpeg (old) and FFmpeg-mt.
Here is tested file description:
[matroska,webm @ 02c3b6f0] Estimating duration from bitrate, this may be
inaccur
ate
Input #0, matroska,webm, from 'W:\test.mkv':
Metadata:
ENCODER : Lavf52.84.0
Duration: 00:00:48.00, start: 0.000000, bitrate: 128 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 1280x720, PAR 1:1 DAR 16:9, 60
fps,
59.94 tbr, 1k tbn, 120 tbc
Stream #0.1: Audio: mp3, 48000 Hz, 2 channels, s16, 128 kb/s
Thanks in advance!
-----------------------------------------------
Kirill Gavrilov,
Software designer.
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user