6

Regards community,

I want to use ffmpeg to generate a file (txt, csv) from audio values. Any idea?

I use this code to generate the audio levels:

ffplay -f lavfi "amovie=input.aac, asplit [a][out1]; [a] showvolume=f=1:b=4:w=800:h=70 [out0]"

Show volume

Thank you a lot

12

The command below will generate a CSV format where the first column represents the audio frame time in seconds, the second column the overall RMS dB volume for that frame, the 3rd column RMS volume for the first channel and the last column the RMS volume for the 2nd channel.

ffprobe -f lavfi -i amovie=input.aac,astats=metadata=1:reset=1 -show_entries frame=pkt_pts_time:frame_tags=lavfi.astats.Overall.RMS_level,lavfi.astats.1.RMS_level,lavfi.astats.2.RMS_level -of csv=p=0

Output:

  Duration: N/A, start: 0.023220, bitrate: N/A
    Stream #0:0: Audio: pcm_f64le, 44100 Hz, stereo, dbl, 5644 kb/s
0.023220,-inf,-inf,-inf
0.046440,-inf,-inf,-inf
0.069660,-inf,-inf,-inf
0.092880,-27.330401,-22.685612,-24.414572
0.116100,-21.141091,-18.986082,-19.931269
0.139320,-20.955719,-18.549085,-19.587788
0.162540,-20.938002,-18.198237,-19.355561
0.185760,-19.852306,-20.032553,-19.941494
0.208980,-20.495281,-21.684953,-21.049508

The reset determines how often the stats are calculated. I've set the value to 1 i.e. calculated for each audio frame in isolation.

6
  • 1
    Really grateful, Is there a way to export it to a file (.txt or .csv)? – Jmv Jmv Jun 27 '16 at 19:36
  • 1
    Sure. Add 1> log.txt at the end. – Gyan Jun 27 '16 at 19:41
  • Excellent Malvya nice to meet you, I'm sorry for another question. Where can I find documentation to do the same with video levels (YCbCr)? I've got it solved on the side playback (ffplay) – Jmv Jmv Jun 27 '16 at 20:04
  • Can you post it as a new question, explaining specifically what you require? – Gyan Jun 28 '16 at 7:10
  • Is there a way to use this with an rtsp stream from an IP camera? – blahreport Aug 7 '19 at 1:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.