[FFmpeg-devel] [RFC] ffmpeg: Improved the performance of 1:N for adaptive bitrate scenario.

James Almer jamrial at gmail.com
Mon Nov 12 21:15:47 EET 2018


On 11/12/2018 4:05 PM, Michael Niedermayer wrote:
> On Mon, Nov 12, 2018 at 03:37:05PM -0300, James Almer wrote:
>> On 11/12/2018 3:28 PM, Michael Niedermayer wrote:
>>> On Sun, Nov 11, 2018 at 07:07:18PM +0800, Jun Zhao wrote:
>>>> Improved the performance of 1 decode + N filter graphs and adaptive
>>>> bitrate scenario.
>>>>
>>>> With new option "-abr_pipeline"
>>>> 1. It enabled multiple filter graph concurrency, which bring above
>>>> about 5%~20% improvement in some 1:N scenario by CPU or GPU
>>>> acceleration
>>>> 2. Next step will continue to improve the concurrency of complex
>>>> filter graph which can support high efficiency of filter net
>>>>
>>>> Below are some test cases and test result as reference.
>>>> (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz)
>>>> (Software: Intel iHD driver - 16.9.00100, CentOS 7)
>>>>
>>>> Command for Intel GPU acceleration case, 1 decode to N scaling:
>>>> ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \
>>>>     -hwaccel_output_format vaapi \
>>>>     -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \
>>>>     -vf "scale_vaapi=1280:720:format=nv12,hwdownload" \
>>>>     -pix_fmt nv12 -f null /dev/null \
>>>>     -vf "scale_vaapi=720:480:format=nv12,hwdownload" \
>>>>     -pix_fmt nv12 -f null /dev/null \
>>>>     -abr_pipeline
>>>>
>>>>     test results:
>>>>                 2 scale
>>>>     Improved       ~34%
>>>>
>>>> Command for CPU only 1 decode to N scaling:
>>>> ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \
>>>>     -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \
>>>>     -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \
>>>>     -abr_pipeline
>>>>
>>>>     test results:
>>>>                 2 scale
>>>>     Improved       ~25%
>>>>
>>>> Command for 1:N transcode by GPU acceleration:
>>>> ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \
>>>>     -hwaccel_output_format vaapi \
>>>>     -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \
>>>>     -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \
>>>>     -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \
>>>>     -abr_pipeline
>>>>
>>>>     test results:
>>>>                 2 scale+enc
>>>>     Improved      ~6.1%
>>>>
>>>> Signed-off-by: Wang, Shaofei <shaofei.wang at intel.com>
>>>> Signed-off-by: Jun Zhao <jun.zhao at intel.com>
>>>> ---
>>>>  fftools/ffmpeg.c        |  236 ++++++++++++++++++++++++++++++++++++++++++++---
>>>>  fftools/ffmpeg.h        |   12 +++
>>>>  fftools/ffmpeg_filter.c |    6 +
>>>>  fftools/ffmpeg_opt.c    |    6 +-
>>>>  4 files changed, 246 insertions(+), 14 deletions(-)
>>>
>>> this breaks build for mingw64
>>>
>>> CC	fftools/ffmpeg_filter.o
>>> CC	fftools/ffmpeg.o
>>> src/fftools/ffmpeg_filter.c: In function ‘init_simple_filtergraph’:
>>> src/fftools/ffmpeg_filter.c:231:39: error: incompatible types when assigning to type ‘pthread_t’ from type ‘int’
>>>              ist->filters[i]->f_thread = 0;
>>>                                        ^
>>> make: *** [fftools/ffmpeg_filter.o] Error 1
>>> make: *** Waiting for unfinished jobs....
>>> src/fftools/ffmpeg.c: In function ‘pipeline_reap_filters’:
>>> src/fftools/ffmpeg.c:1534:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
>>>      OutputStream *ost = output_streams[i];
>>>      ^
>>> src/fftools/ffmpeg.c: In function ‘do_streamcopy’:
>>> src/fftools/ffmpeg.c:2177:5: warning: ‘av_copy_packet_side_data’ is deprecated (declared at src/libavcodec/avcodec.h:4423) [-Wdeprecated-declarations]
>>>      av_copy_packet_side_data(&opkt, pkt);
>>>      ^
>>> src/fftools/ffmpeg.c: In function ‘filter_pipeline’:
>>> src/fftools/ffmpeg.c:2405:5: warning: ‘return’ with no value, in function returning non-void [enabled by default]
>>>      return;
>>>      ^
>>> src/fftools/ffmpeg.c: In function ‘send_frame_to_filters’:
>>> src/fftools/ffmpeg.c:2444:42: error: invalid operands to binary == (have ‘pthread_t’ and ‘int’)
>>>              if(ist->filters[i]->f_thread == 0) {
>>
>> How old is your mingw64 toolchain? It should be using the w32threads
>> wrapper or some library like winpthreads, but it's not.
> 
> IIRC its the mingw that came with the distribution which is still ubuntu 14.04
> It will get upgraded when i update ubuntu on that box. 

Yeah, a build that old is probably missing CONDITION_VARIABLE and/or
INIT_ONCE, which are needed by the wrapper.


More information about the ffmpeg-devel mailing list