diff mbox

[FFmpeg-devel] Check if we do have also a filter_complex filter.

Message ID 20190327211200.178030-1-tfoucu@gmail.com
State Accepted
Commit 0ac3befd479877f11c795ecef8bf1ce2184c5a7a
Headers show

Commit Message

Thierry Foucu March 27, 2019, 9:11 p.m. UTC
Right now, the code check for no filter description, but if we use a
filter_complex, the code will use the AVFrame.duration which could be
wrong in case of using fps filter.

How to reproduce the problem:
ffmpeg -f lavfi -i testsrc=duration=1 -vf fps=fps=50 -vsync 1 -f null -
output 50 frames

ffmpeg -f lavfi -i testsrc=duration=1 -filter_complex fps=fps=50 -vsync 1 -f null -
output 51 frames

With the patch, the same command will always output 50 frames.

---
 fftools/ffmpeg.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael Niedermayer March 28, 2019, 8:27 p.m. UTC | #1
On Wed, Mar 27, 2019 at 02:11:59PM -0700, Thierry Foucu wrote:
> Right now, the code check for no filter description, but if we use a
> filter_complex, the code will use the AVFrame.duration which could be
> wrong in case of using fps filter.
> 
> How to reproduce the problem:
> ffmpeg -f lavfi -i testsrc=duration=1 -vf fps=fps=50 -vsync 1 -f null -
> output 50 frames
> 
> ffmpeg -f lavfi -i testsrc=duration=1 -filter_complex fps=fps=50 -vsync 1 -f null -
> output 51 frames
> 
> With the patch, the same command will always output 50 frames.
> 
> ---
>  fftools/ffmpeg.c | 1 +
>  1 file changed, 1 insertion(+)

will apply

thanks

[...]
diff mbox

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 544f1a1cef..0f157d67d8 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1079,6 +1079,7 @@  static void do_video_out(OutputFile *of,
 
     if (!ost->filters_script &&
         !ost->filters &&
+        (nb_filtergraphs == 0 || !filtergraphs[0]->graph_desc) &&
         next_picture &&
         ist &&
         lrintf(next_picture->pkt_duration * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)) > 0) {