Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5526 closed defect (fixed)

Wrong Framerate detection when input DirectShow Filter

Reported by: kgp700 Owned by:
Priority: important Component: avdevice
Version: git-master Keywords: dshow codecpar regression
Cc: Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Frame drop log appear constantly when rtmp live encoding
This problem occur when do not specify input framerate on ffmpeg

Input source :
Video : FFSplit (Capture region - Live Screen capture)
Input Video FPS : 30fps
Audio : Creative X-FI Xtreme Music : What U Hear (Stereo Mix)

but It log seems to be wrong.. Actually I can't see frame drop on video

If occur this problem, increase framedrop log constantly
like this : increase framedrop count log per 3sec or 10sec...
It's constantly increase

When I seen the logfile, I found some two weird things
1. Output framerate not constant
Sometimes Output framerate is 29.92fps or 29.83fps...
If normal situation, It must be always 30fps

On the Old ffmpeg build (Build at 9/April), always 30fps

2.Input tbr is not constant
I found input video's tbr will be output video framerate
On the Old ffmpeg build (9,April), input video's tbr was always 30tbr constantly

but not on recenty ffmpeg build (9,May)
tbr randomly change to 29.92tbr or 29.83tbr...

My current ffmpeg git commit is 5fce4753ff0f9e4ebada3fa3619e0cf0b639385d

Please fix it
Thanks

How to reproduce:

% ffmpeg.exe -y -rtbufsize 2000M -f dshow -audio_buffer_size 65 -i "video=FFsource:audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\\wave_{5008F0BE-0452-4160-883F-D2F5AB95D3FD}" -pix_fmt yuv420p -filter_complex "null,scale=1152x648:flags=lanczos,unsharp=lx=5:ly=5:la=0.27:cx=5:cy=5:ca=0,pp=ha:a/va:a/fq:38" -vcodec libx264 -preset faster -profile:v high -crf 17 -g 120 -x264opts "fullrange=off:colorprim=bt709:ref=4:colorprim=bt709:fullrange=off:me=umh:ref=2:mixed-refs=1:deblock=3,3:8x8dct=1:bframes=0:merange=18:subme=9:psy-rd=0.00,0.37:direct=temporal:chroma_me=1:weightp=0:no-dct-decimate=1:no-fast-pskip=1:rc_lookahead=50:qcomp=0.6:ipratio=1.41:aq-mode=3:trellis=2:aq-strength=0.8:b-adapt=1:scenecut=45:keyint-min=60 -aspect 1152/648 -bufsize:v 1780k -maxrate:v 1780k -report -map 0 -acodec libfdk_aac -b:a 224k -ar 48000 -map_metadata -1 -map_chapters -1

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

ffmpeg-20160509-224324.log (2.1 MB ) - added by kgp700 6 years ago.
FFmpeg log (too big file, omit some logs)

Change History (15)

by kgp700, 6 years ago

Attachment: ffmpeg-20160509-224324.log added

FFmpeg log (too big file, omit some logs)

comment:1 by kgp700, 6 years ago

I think this problem caused by commit ID 6f69f7a8bf6a0d013985578df2ef42ee6b1c7994
(lavf: replace AVStream.codec with AVStream.codecpar)

comment:2 by kgp700, 6 years ago

Summary: Frame drop log constantly when rtmp live encodingWrong Frame drop log appear when rtmp live encoding

comment:3 by kgp700, 6 years ago

Summary: Wrong Frame drop log appear when rtmp live encodingWrong Framerate detection when rtmp live encoding

comment:4 by kgp700, 6 years ago

When I was write this problem, I thought just something wrong on logging part
but It was not.
If not specify input framerate, FFmpeg wrong recognize input video tbr
So, actually output video framerate also wrong

comment:5 by Carl Eugen Hoyos, 6 years ago

Component: ffmpegundetermined
Keywords: codecpar regression added
Priority: normalimportant

comment:6 by kgp700, 6 years ago

Summary: Wrong Framerate detection when rtmp live encodingWrong Framerate detection with input DirectShow Filter

comment:7 by kgp700, 6 years ago

Summary: Wrong Framerate detection with input DirectShow FilterWrong Framerate detection when input DirectShow Filter

comment:8 by kgp700, 6 years ago

I did additional tests
It's not relate rtmp or live streaming
so, I changed title

I don't know in detail, rfps(void ff_rfps_calculate(AVFormatContext *ic)) is measure real framerate feature?

I compared Old version ffmpeg and recently version log.
The difference is get framerate information by rfps or not

I think rfps is not good feature for DirectShow filters (especially for kind of screen capture filters)

Can not disable rfps feature when input DirectShow filters?

comment:9 by Michael Niedermayer, 6 years ago

Cc: Michael Niedermayer added

Try setting r_frame_rate in addition to avg_frame_rate or try to set the codec time_base.
Ive no easy way to test this.
Also all other video capture devices we have must be tested, its quite possible they suffer from the same bug

comment:10 by kgp700, 6 years ago

How to setting r_frame_rate in addition to avg_frame_rate or try to set the codec time_base?
sorry I don't know how to input parameters...

BTW, If you want reproduce this bug, try input ffsplit screen capture feature (monitor capture)(You can download on http://www.ffsplit.com/)

comment:11 by Michael Niedermayer, 6 years ago

try to add to

st->avg_frame_rate = av_inv_q(time_base);

this

st->r_frame_rate = av_inv_q(time_base);

or

st->internal->avctx->time_base  = time_base;

you will have to change the source of dshow.c and rebuild for this, also make sure that if you test with some external application that the rebuild lib is used

comment:12 by kgp700, 6 years ago

I tried st->avg_frame_rate = av_inv_q(time_base);
to
st->avg_frame_rate = av_inv_q(time_base);
st->r_frame_rate = av_inv_q(time_base);
on dshow.c

Problem fixed. Thanks :)
Can you apply to master git?

comment:13 by Michael Niedermayer, 6 years ago

Resolution: fixed
Status: newclosed

comment:14 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavdevice
Keywords: dshow added
Note: See TracTickets for help on using tickets.