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

Michael Niedermayer michael at niedermayer.cc
Mon Nov 12 20:28:01 EET 2018


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) {
                                          ^
src/fftools/ffmpeg.c: In function ‘init_output_stream’:
src/fftools/ffmpeg.c:3747:9: warning: ‘avcodec_copy_context’ is deprecated (declared at src/libavcodec/avcodec.h:4195) [-Wdeprecated-declarations]
         ret = avcodec_copy_context(ost->st->codec, ost->enc_ctx);
         ^
src/fftools/ffmpeg.c:3747:9: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:878) [-Wdeprecated-declarations]
src/fftools/ffmpeg.c:3793:9: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:878) [-Wdeprecated-declarations]
         ost->st->codec->codec= ost->enc_ctx->codec;
         ^
src/fftools/ffmpeg.c: In function ‘check_keyboard_interaction’:
src/fftools/ffmpeg.c:4174:13: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:878) [-Wdeprecated-declarations]
             debug = input_streams[0]->st->codec->debug<<1;
             ^
src/fftools/ffmpeg.c:4197:13: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:878) [-Wdeprecated-declarations]
             input_streams[i]->st->codec->debug = debug;
             ^
make: *** [fftools/ffmpeg.o] Error 1

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20181112/e698095a/attachment.sig>


More information about the ffmpeg-devel mailing list