Re: [FFmpeg-user] x-axis range of drawgraph picture mode

2018-04-09 Thread Dave Rice

> On Apr 9, 2018, at 4:12 PM, Dave Rice  wrote:
> 
> Hi ffmpeg-user,
> 
> I’m using drawgraph with slide=picture in order to make some still images of 
> audiovisual metrics upon a timeline. I’d like to use drawgraph and drawtext 
> in order to overlay some x-axis markers and label the timeline; however I’m 
> unclear how the x-axis is represented in this mode. For instance, the example 
> below plots lavfi.astats.1.Min_level for a 60 second sample, but the 
> resulting image appears to have a x-axis that represents more than 60 
> seconds. The result appears to roughly plot about 80 seconds with the 60-80 
> second range being blank. 
> 
> ffmpeg -f lavfi -i 
> "aevalsrc=d=60:exprs=sin(PI*t):s=48000,aformat=sample_fmts=dbl,astats=metadata=1:reset=1,adrawgraph=m1=lavfi.astats.1.Min_level:max=1:min=-1:slide=picture:s=1920x240"
>  -y test.png
> 
> Is there some math that I can use to determine the maximum value of the 
> x-axis from the plotted image?

Responding to myself here, but the max of the x-axis in this drawgraph example 
is found via:

variables from the command:
sample_rate = 48000
duration = 60
number_of_sample_in_audio_frame = 2048
drawgraph_width = 1920

temp variables:
TILE_FLOOR=  floor   ( ( ( sample_rate * duration ) / 
number_of_sample_in_audio_frame ) / drawgraph_width )
TILE_MOD=modulo  ( ( ( sample_rate * duration ) / 
number_of_sample_in_audio_frame ) / drawgraph_width , drawgraph_width)
TILE_CEILING=ceiling ( ( ( sample_rate * duration ) / 
number_of_sample_in_audio_frame ) / drawgraph_width )

result:
X-AXIS-MAX=duration / ( TILE_FLOOR * drawgraph_width + TILE_MOD ) / ( 
TILE_CEILING * drawgraph_width )

or 
TILE_FLOOR=0
TILE_MOD=1,406.25
TILE_CEILING=1

or
X-AXIS-MAX=81.9194174619 seconds

So my guess of 80 seconds was close.

Best Regards,
Dave Rice
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-user] x-axis range of drawgraph picture mode

2018-04-09 Thread Dave Rice
Hi ffmpeg-user,

I’m using drawgraph with slide=picture in order to make some still images of 
audiovisual metrics upon a timeline. I’d like to use drawgraph and drawtext in 
order to overlay some x-axis markers and label the timeline; however I’m 
unclear how the x-axis is represented in this mode. For instance, the example 
below plots lavfi.astats.1.Min_level for a 60 second sample, but the resulting 
image appears to have a x-axis that represents more than 60 seconds. The result 
appears to roughly plot about 80 seconds with the 60-80 second range being 
blank. 

ffmpeg -f lavfi -i 
"aevalsrc=d=60:exprs=sin(PI*t):s=48000,aformat=sample_fmts=dbl,astats=metadata=1:reset=1,adrawgraph=m1=lavfi.astats.1.Min_level:max=1:min=-1:slide=picture:s=1920x240"
 -y test.png

Is there some math that I can use to determine the maximum value of the x-axis 
from the plotted image?

Full output:

ffmpeg -f lavfi -i 
"aevalsrc=d=60:exprs=sin(PI*t):s=48000,aformat=sample_fmts=dbl,astats=metadata=1:reset=1,adrawgraph=m1=lavfi.astats.1.Min_level:max=1:min=-1:slide=picture:s=1920x240"
 -y test.png
ffmpeg version N-51550-g41d7c4d381 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-41d7c4d --enable-shared 
--enable-pthreads --enable-version3 --enable-hardcoded-tables 
--enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl 
--enable-ffplay --enable-libfreetype --enable-libmp3lame --enable-libx264 
--enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil  56.  9.100 / 56.  9.100
  libavcodec 58. 14.100 / 58. 14.100
  libavformat58. 10.100 / 58. 10.100
  libavdevice58.  2.100 / 58.  2.100
  libavfilter 7. 13.100 /  7. 13.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale  5.  0.102 /  5.  0.102
  libswresample   3.  0.101 /  3.  0.101
  libpostproc55.  0.100 / 55.  0.100
[Parsed_aevalsrc_0 @ 0x7f803550] EOF timestamp not reliable
Input #0, lavfi, from 
'aevalsrc=d=60:exprs=sin(PI*t):s=48000,aformat=sample_fmts=dbl,astats=metadata=1:reset=1,adrawgraph=m1=lavfi.astats.1.Min_level:max=1:min=-1:slide=picture:s=1920x240':
  Duration: N/A, start: 0.00, bitrate: N/A
Stream #0:0: Video: rawvideo (RGBA / 0x41424752), rgba, 1920x240 [SAR 1:1 
DAR 8:1], 48k tbr, 48k tbn, 48k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> png (native))
Press [q] to stop, [?] for help
[image2 @ 0x7f8036801400] Frame rate very high for a muxer not efficiently 
supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
Output #0, image2, to 'test.png':
  Metadata:
encoder : Lavf58.10.100
Stream #0:0: Video: png, rgba, 1920x240 [SAR 1:1 DAR 8:1], q=2-31, 200 
kb/s, 48k fps, 48k tbn, 48k tbc
Metadata:
  encoder : Lavc58.14.100 png
frame=1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A 
speed=0.00116x
video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing 
overhead: unknown
[Parsed_astats_2 @ 0x7f8035500640] Channel: 1
[Parsed_astats_2 @ 0x7f8035500640] DC offset: -0.016786
[Parsed_astats_2 @ 0x7f8035500640] Min level: -0.033504
[Parsed_astats_2 @ 0x7f8035500640] Max level: 0.00
[Parsed_astats_2 @ 0x7f8035500640] Min difference: 0.65
[Parsed_astats_2 @ 0x7f8035500640] Max difference: 0.65
[Parsed_astats_2 @ 0x7f8035500640] Mean difference: 0.66
[Parsed_astats_2 @ 0x7f8035500640] RMS difference: 0.66
[Parsed_astats_2 @ 0x7f8035500640] Peak level dB: -29.498054
[Parsed_astats_2 @ 0x7f8035500640] RMS level dB: -34.255905
[Parsed_astats_2 @ 0x7f8035500640] RMS peak dB: -34.255905
[Parsed_astats_2 @ 0x7f8035500640] RMS trough dB: -34.255905
[Parsed_astats_2 @ 0x7f8035500640] Crest factor: 1.729388
[Parsed_astats_2 @ 0x7f8035500640] Flat factor: 0.00
[Parsed_astats_2 @ 0x7f8035500640] Peak count: 1
[Parsed_astats_2 @ 0x7f8035500640] Bit depth: 59/64
[Parsed_astats_2 @ 0x7f8035500640] Dynamic range: 60.204373
[Parsed_astats_2 @ 0x7f8035500640] Overall
[Parsed_astats_2 @ 0x7f8035500640] DC offset: -0.016786
[Parsed_astats_2 @ 0x7f8035500640] Min level: -0.033504
[Parsed_astats_2 @ 0x7f8035500640] Max level: 0.00
[Parsed_astats_2 @ 0x7f8035500640] Min difference: 0.65
[Parsed_astats_2 @ 0x7f8035500640] Max difference: 0.65
[Parsed_astats_2 @ 0x7f8035500640] Mean difference: 0.66
[Parsed_astats_2 @ 0x7f8035500640] RMS difference: 0.66
[Parsed_astats_2 @ 0x7f8035500640] Peak level dB: -29.498054
[Parsed_astats_2 @ 0x7f8035500640] RMS level dB: -34.255905
[Parsed_astats_2 @ 0x7f8035500640] RMS peak dB: -34.255905
[Parsed_astats_2 @ 0x7f8035500640] RMS trough dB: -34.255905
[Parsed_astats_2 @ 0x7f8035500640] Flat factor: 0.00
[Parsed_astats_2 @ 0x7f8035500640] Peak count: 1.00
[Parsed_astats_2 @ 0x7f8035500640] Bit depth: 59/64
[Parsed_astats_2 @ 0x7f8035500640] Number of samples: 512

Best Regards,

Dave Rice