diff mbox series

[FFmpeg-devel,v2,2/2] lavfi/vf_vpp_qsv: fix the time_base for outlink

Message ID 20210611021946.1437868-2-haihao.xiang@intel.com
State Accepted
Headers show
Series [FFmpeg-devel,v2,1/2] lavc/qsvdec: fix pts | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Xiang, Haihao June 11, 2021, 2:19 a.m. UTC
Since commit 89ffcd1, the status pts of the output link is set to a
value in the input link time base, not in the output link time base when
EOF is reached. Usually this pst value is larger than the required one
because the output link time base is more greater than the input link
time base. When "-vf vpp_qsv,fps" is used, user has to wait a long time
for the ending of the pipeline because fps filter output a huge number
of frames until the wrong status pts is hit.

The issue can be triggered with the command below (use a clip with 1000
frames in this case):

$> time ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.h265 -vf
"vpp_qsv=w=1920:h=1080,fps=fps=30" -f null -
...
[out_0_0 @ 0x564ccd27e020] 10000000 buffers queued in out_0_0, something
may be wrong.
frame=40119596 fps=88080 q=-0.0 Lsize=N/A time=371:28:39.96 bitrate=N/A
speed=2.94e+03x
video:17238889kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown

real    9m7.451s
user    2m34.102s
sys     0m39.734s

In order to avoid the above issue, the same time base for input and
ouput links is used in this patch.

Fixes ticket #9286
---
v2: update the commit log

 libavfilter/vf_vpp_qsv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rogozhkin, Dmitry V June 11, 2021, 5:50 p.m. UTC | #1
On Fri, 2021-06-11 at 10:19 +0800, Haihao Xiang wrote:
> Since commit 89ffcd1, the status pts of the output link is set to a
> value in the input link time base, not in the output link time base
> when
> EOF is reached. Usually this pst value is larger than the required
> one
> because the output link time base is more greater than the input link
> time base. When "-vf vpp_qsv,fps" is used, user has to wait a long
> time
> for the ending of the pipeline because fps filter output a huge
> number
> of frames until the wrong status pts is hit.
> 
> The issue can be triggered with the command below (use a clip with
> 1000
> frames in this case):
> 
> $> time ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.h265 -vf
> "vpp_qsv=w=1920:h=1080,fps=fps=30" -f null -
> ...
> [out_0_0 @ 0x564ccd27e020] 10000000 buffers queued in out_0_0,
> something
> may be wrong.
> frame=40119596 fps=88080 q=-0.0 Lsize=N/A time=371:28:39.96
> bitrate=N/A
> speed=2.94e+03x
> video:17238889kB audio:0kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: unknown
> 
> real    9m7.451s
> user    2m34.102s
> sys     0m39.734s
> 
> In order to avoid the above issue, the same time base for input and
> ouput links is used in this patch.
> 
> Fixes ticket #9286

This commit log looks good to me. Thank you for update. @maintainers:
please, help to review and merge.

> ---
> v2: update the commit log
> 
>  libavfilter/vf_vpp_qsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> index b9ab5c6490..74d1d51e7c 100644
> --- a/libavfilter/vf_vpp_qsv.c
> +++ b/libavfilter/vf_vpp_qsv.c
> @@ -303,7 +303,7 @@ static int config_output(AVFilterLink *outlink)
>      outlink->w          = vpp->out_width;
>      outlink->h          = vpp->out_height;
>      outlink->frame_rate = vpp->framerate;
> -    outlink->time_base  = av_inv_q(vpp->framerate);
> +    outlink->time_base  = inlink->time_base;
>  
>      param.filter_frame  = NULL;
>      param.num_ext_buf   = 0;
diff mbox series

Patch

diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index b9ab5c6490..74d1d51e7c 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -303,7 +303,7 @@  static int config_output(AVFilterLink *outlink)
     outlink->w          = vpp->out_width;
     outlink->h          = vpp->out_height;
     outlink->frame_rate = vpp->framerate;
-    outlink->time_base  = av_inv_q(vpp->framerate);
+    outlink->time_base  = inlink->time_base;
 
     param.filter_frame  = NULL;
     param.num_ext_buf   = 0;