[FFmpeg-user] Problem with astats and adrawgraph

Gyan ffmpeg at gyani.pro
Tue Nov 26 20:12:54 EET 2019



On 26-11-2019 10:53 pm, Michael Koch wrote:
> Am 26.11.2019 um 17:48 schrieb Michael Koch:
>> Am 26.11.2019 um 17:32 schrieb Michael Koch:
>>> Am 26.11.2019 um 14:26 schrieb Paul B Mahol:
>>>>
>>>>> 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
>>>>>
>>>> Use asetnsamples, to change size of audio frame to match you video 
>>>> FPS.
>>>
>>> At which place would you insert it? I did insert 
>>> asetnsamples=n=48000/25 before astats and now I get "Error while 
>>> filtering: Cannot allocate memory"
>>
>> It works when I replace 48000/25 by 1920. Problem solved.
>
> It seems that in some cases expressions are allowed and in other cases 
> they are not allowed.
> For example settb=1/25 is ok, but asetnsamples=n=48000/25 gives an 
> unclear error message.
> How can the user know for which parameters it's allowed to use 
> expressions and for which not?
> I mean without try and error.

Run ffmpeg -h filter=asetnsamples to list its options. Option `n` 
accepts <int> so it expects a number.

Gyan


More information about the ffmpeg-user mailing list