#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    200
    Rep Power
    12

    Question Getting value from file using Windows Batch scripting


    Using Windows Batch scripting, I want to get the max_volume value (-2.9 in the following example) from a ffmpeg output written to a log file:

    [Parsed_volumedetect_0 @ 0000000005428b20] n_samples: 13406208
    [Parsed_volumedetect_0 @ 0000000005428b20] mean_volume: -20.4 dB
    [Parsed_volumedetect_0 @ 0000000005428b20] max_volume: -2.9 dB
    [Parsed_volumedetect_0 @ 0000000005428b20] histogram_2db: 7
    [Parsed_volumedetect_0 @ 0000000005428b20] histogram_3db: 181
    [Parsed_volumedetect_0 @ 0000000005428b20] histogram_4db: 963
    [Parsed_volumedetect_0 @ 0000000005428b20] histogram_5db: 2774
    [Parsed_volumedetect_0 @ 0000000005428b20] histogram_6db: 6614
    [Parsed_volumedetect_0 @ 0000000005428b20] histogram_7db: 14743
    Once I know that value I intend to use it in some calculations.

    Thanks a lot in advance.

    Mapg
    Last edited by mapg; November 23rd, 2014 at 06:30 PM.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    Install gawk, then use the command

    gawk "/max_volume/{print $(NF-1)}" filename
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    200
    Rep Power
    12
    Originally Posted by b49P23TIvg
    Install gawk, then use the command

    gawk "/max_volume/{print $(NF-1)}" filename
    Thank you very much! I will check it.

    Kind regards

IMN logo majestic logo threadwatch logo seochat tools logo