[FFmpeg-user] Problem with astats and adrawgraph

Michael Koch astroelectronic at t-online.de
Tue Nov 26 14:46:34 EET 2019


>> Thanks for your suggestion. Adding -r 25 does indeed solve the problem.
>> Although I don't understand why it is required. The input framerate is
>> 25 and it's detected correctly when I use the simpler filter chain.
>>
> Ah, I know why this happens, you need to use settb=1/FPS filter after vstack.
> This happens because adrawgraph filter it order to not drop output
> frames need to have same timebase as input audio. Otherwise you would
> get different metadata values.
> Also note that your FPS in this case is 48000/1024. ~= 46.xxx

48000 is the audio sample rate, but where does the 1024 come from?

I have a new example with testsrc2 and anoisesrc. There is no input file 
required for reproducing.
There are two graphs: The first one uses signalstats and drawgraph, and 
the second one uses astats and adrawgraph. The problem is that the two 
graphs don't advance with the same speed in X direction. Do you have an 
idea how to make them synchrone?The video width is the same in both 
cases, otherwise vstack wouldn't work.
The speed of drawgraph is correct, 1 pixel per frame. The speed of 
adrawgraph is too fast.

Other question: reset=1 in astats means that the calculation result is 
reset after each frame. But how does the filter know when a frame ends, 
if the input of this filter is only an audio signal?

c://ffmpeg/ffmpeg -f lavfi -i testsrc2=size=hd1080:duration=10:rate=25 
-f lavfi -i anoisesrc=d=10:c=pink:r=48000 -lavfi 
[0]signalstats,drawgraph=m1=lavfi.signalstats.YAVG:mode=line:slide=scroll:min=0:max=255,settb=1/25[G1];[1]astats=metadata=1:reset=1,adrawgraph=m1=lavfi.astats.1.RMS_level:mode=line:slide=scroll:min=-90:max=0,settb=1/25[G2];[G1][G2]vstack,settb=1/25 
-r 25 -y test.mp4

Michael



More information about the ffmpeg-user mailing list