For videos with sound, save information about audio volume levels in the media asset's metadata. These values are stored: * FFmpeg:AudioPeakLoudness The peak loudness of the audio track, from 0.0 (silent) to 1.0 (max volume) * FFmpeg:AudioAverageLoudness The average loudness of the audio track, from 0.0 (silent) to 1.0 (max volume). * FFmpeg:AudioLoudnessRange The difference between the quietest and loudest sounds in the audio track (in decibels). * FFmpeg:AudioSilencePercentage The percentage of the video that is silent (1.0 is completely silent, 0.5 is 50% silence, 0.0 is no silence). These values are calculated based on the EBU R 128 standard, using the ffmpeg command below: ffmpeg -i file.mp4 -af silencedetect=duration=0.05:noise=0.0001,ebur128=metadata=1:peak=true:dualmono=true -f null /dev/null See the links below for details: * https://en.wikipedia.org/wiki/EBU_R_128 * https://www.ffmpeg.org/ffmpeg-filters.html#ebur128-1 * https://tech.ebu.ch/loudness * https://tech.ebu.ch/docs/tech/tech3341.pdf
Logical
This directory contains library code used through Danbooru. This includes things like defining API clients, dealing with sources, parsing tag searches, storing and resizing images, and so on.
Many of the files here use the Service Object pattern. Instead of putting complex code in models or controllers, it goes here, in plain old Ruby objects (POROs). This keeps models and controllers simpler, and keeps domain logic isolated and independent from the database and the HTTP request cycle.