Try to read volume values in several places with ffprobe.
With "aselect=between(...)+between(...)..." the script takes a very long time if the file is larger.
I tried using ffmpeg and volumedetect, but then the script would also have to process the file several times in the for loop.
My idea is to replace "aselect=between(...)+between(...)..." with "atrim=0+500+1000:2+502+1002", but I don't know how atrim can be defined multiple times.
With "-read_intervals 10% +#2" an error appears and I also do not know how a multiple definition is possible.
Maybe someone knows a faster alternative without a for loop with ffprobe, or if it is impossible with ffmpeg?
Output should be from 00:00:00-00:00:01 + 00:05:00-00:05:01 + 01:00:00-01:00:01 (1-5 output values each) look something like this:
-57.367694
-42.888538
-15.361602
-15.909571
-22.198203
-23.783564
My example:
Code: Select all
ffprobe -v error -hide_banner -show_entries frame=pkt_pts_time:frame_tags=lavfi.astats.Overall.RMS_level -of default=noprint_wrappers=1:nokey=1 \
-f lavfi amovie="FILE.mp4",asetnsamples=$(ffprobe -i "FILE.mp4" -v error -hide_banner -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1),astats=metadata=1:reset=1,aselect="between(n\,0\,1)+between(n\,500\,501)+between(n\,1000\,1001)"