Copyright 2021 - HappyOtterScripts by The Happy Otter
LoudToOpacity enables the user to control the opacity of a video track based on the loudness of the audio. Using a loudness log generated using either FFmpeg or Vegas, points are produced and added to a composite envelope for the selected video track. To use LoudToOpacity, the following steps are required.
1. Create selection loop.
2. Decide whether to use Vegas or FFmpeg
2. If Vegas, enter Tools|Generate Loudness Log
3. Launch script and select Vegas or FFmpeg
4. Select tracks and channel mapping
5. Select Video Track from DropDown
6. Select type of loudness measure
7. Enter LUFS/dB value below which opacity is 100%
8. Enter LUFS/dB value above which opacity is 0%
9. Select quantize to frames and start value options
1. Select Tracks to Include. When the script launches, audio tracks are displayed which may be selected/deselected by simply clicking on the track. Information displayed includes the displayed track index, the name of the track and whether the track is Mono, Stereo, Left (left only channel), or Right (right only channel).
a. Selects/deselects all tracks.
b. Resets audio tracks mute/solo to default.
c. Resets channel mapping to default
d. Toggles the selected track between Stereo, Left only, and Right only. Channels for all events on the selected track will be remapped based on this selection.
2. Generate Log Using. The loudness log may be generated using either Vegas or FFmpeg.
a. FFmpeg. (Recommended). If selected, FFmpeg will be used to generate a loudness log using its internal Ebur128 filter. An audio wave file for the selection loop will first be rendered from Vegas from which the log file will be generated.
b. Vegas. If selected, the internally-generated Vegas log file will be used. Note that the log file MUST be generated before launching the script. In other words, all track/channel selections must be made by the user before generating the log.
c. Opens the generated log file using the user's default text editor.
3. Select Measures. Three measures may be used for generating keyframes.
a. Momentary LUFS. Momentary LUFS (Loudness Units Full Scale) are based on a 100 millisecond integration window for FFmpeg and a 400 millisecond window for Vegas. In other words, the FFmpeg log scale will produce four times the number of keyframes produced by the Vegas measure.
b. Short LUFS. Short loudness unit based on a 3 second integration window for Vegas and an unknown length using FFmpeg.
c. True Peak dB. True peak dB is available only when using FFmpeg. It makes use of a higher internal sampling rate to provide accurate estimates.
4. Other Options.
a. Select Target Video Track. A dropdown box which enables the user to select which Video track the composite envelope will be created and keyframes applied.
b. Estimates the range of values for both LUFS and Peak dB and inserts them into the numerical up/down boxes as starting points.
b. Resets the composite envelope for the selected video track.
c. Set LUFS for 100%. Loudness values below this amount will set the opacity level to 100%. For the above settings, anything louder than -8 LUFS will result in 100% opacity.
d. Set LUFS for 0%. Loudness values above this amount will set the opacity level to 0% (i.e. black). For the above settings, anything quieter than -15 LUFS will result in 0% opacity.
e. Saved LUFS Templates. Settings may be saved for future use. To create a template, first choose the LUFS values using the up down boxes. Any changes will result in "<Unsaved>" being displayed in the drop down box. To save, click on the drop down box, enter a new name and then click on the green plus button . To remove a saved template, right-click on the selected template and then choose "Yes" to remove the template.
f. Quantize Points to Video Frames. If ticked, keyframes will be placed at the nearest video frame boundary.
g. Restore track mute/solo on exit. When the script launches, it saves the mute and solo values for each track. If ticked, those values will be restored when the script exits.
h. Set envelope start value to the value of the first sample point. Since no loudness values exist on the first frame (first 300 ms using FFmpeg) the starting opacity will be 100%. If ticked, the starting value will be changed to the value of the first sample point.
i. Flip All Points. It ticked, envelope points will be "flipped". In other words, 100% opacity will now become 0% opacity and vice-versa.
j. Auto Update. If ticked, the keyframes will be updated each time there is a change in the value of one of the LUFS up/down boxes.
5. Start. A new wave file will first be rendered and a new loudness generated before computing the keyframes. Note that this applies only when FFmpeg is being used.
6. Update. Computes keyframes based on the existing loudness log file. Note that this applies to both FFmpeg and Vegas generated log files.
7. Exit. Exits the script and closes the dialog.