XaiJu
EkafdpSEAsub
EkafdpSEAsub

patreon


Dynamic Video Enhancer: Random Cut & Overlay Edition

The script above is designed for Adobe After Effects and serves as a versatile tool for randomizing and enhancing videos. It offers several features that can be used creatively in various ways. Firstly, the script cuts and resizes the video randomly, introducing dynamic variations to the composition. This capability is particularly useful for creating visually engaging sequences or adding an element of surprise to video projects. Additionally, the script applies a blue color overlay on top of the video, offering a quick and convenient way to give the footage a cohesive and stylized look. The opacity of the overlay can be adjusted to achieve the desired level of intensity.

This script is incredibly useful for content creators, filmmakers, and video editors looking to experiment with different visual effects and create unique videos. By randomizing the cuts and resizing, the script can generate eye-catching transitions and dynamic sequences that capture viewers' attention. The blue color overlay adds a professional and stylistic touch to the footage, making it visually appealing and suitable for a variety of themes and moods. Whether it's for music videos, commercials, vlogs, or experimental film projects, this script empowers users to explore endless creative possibilities and enhance their videos in engaging and unexpected ways. Its versatility and simplicity make it an invaluable tool in the arsenal of video editing techniques, allowing users to achieve professional results efficiently and effortlessly.






// Random Audio Randomization Script for Adobe After Effects


// Get the selected composition

var composition = app.project.activeItem;


// Check if a composition is selected

if (composition && composition instanceof CompItem) {

  // Create a new comp for the final video

  var finalComp = app.project.items.addComp("Final Video", composition.width, composition.height, composition.pixelAspect, composition.duration, composition.frameRate);


  // Get the video layer from the composition

  var videoLayer = composition.layer(1); // Assuming the video layer is the first layer


  // Get the audio layer from the composition

  var audioLayer = composition.layer(2); // Assuming the audio layer is the second layer


  // Duplicate the audio layer

  var duplicatedAudioLayer = audioLayer.duplicate();


  // Set the starting time of the duplicated audio layer

  duplicatedAudioLayer.startTime = 0;


  // Create a null layer for controlling the audio level

  var audioControlLayer = finalComp.layers.addNull();

  audioControlLayer.name = "Audio Control";


  // Connect the duplicated audio layer to the audio control layer

  duplicatedAudioLayer.parent = audioControlLayer;


  // Get the brightness values for each frame

  var brightnessValues = getBrightnessValues(videoLayer);


  // Set the random audio levels based on brightness

  for (var i = 1; i <= composition.numLayers; i++) {

    var layer = composition.layer(i);


    // Check if the layer is a footage layer

    if (layer instanceof AVLayer && layer.canSetAudioLevels) {

      for (var j = 1; j <= layer.source.duration * composition.frameRate; j++) {

        var brightness = brightnessValues[j - 1];


        // Set the audio level based on brightness

        var randomAudioLevel = brightness * 100; // Multiply brightness by 100 to get a value between 0 and 100

        layer.audio.audioLevels.setValueAtTime(j / composition.frameRate, [randomAudioLevel, randomAudioLevel]);

      }

    }

  }


  // Set the output file path

  var outputPath = Folder.desktop.fsName + "/FinalVideo.mp4";


  // Export the final composition with default settings

  finalComp.exportFile(outputPath, "Adobe Media Encoder");


  alert("Video exported successfully!");


} else {

  alert("Please select a composition.");

}


// Function to get the brightness values for each frame of a video layer

function getBrightnessValues(layer) {

  var brightnessValues = [];

  var frameDuration = 1 / layer.source.frameRate;


  // Iterate through each frame of the layer

  for (var i = 1; i <= layer.source.duration * layer.source.frameRate; i++) {

    // Set the time of the layer to the current frame

    layer.time = (i - 1) * frameDuration;


    // Create a temporary solid layer to extract the brightness information

    var tempSolidLayer = layer.containingComp.layers.addSolid([1, 1, 1], "Temp Solid", layer.width, layer.height, layer.pixelAspect, layer.source.duration);


    // Set the transfer mode to "Difference"

    tempSolidLayer.blendingMode = BlendingMode.DIFFERENCE;


    // Apply the current frame of the layer to the solid layer

    tempSolidLayer.source = layer.source;


    // Apply the "Brightness & Contrast" effect to the solid layer

    var brightnessContrastEffect = tempSolidLayer.Effects.addProperty("ADBE Brightness & Contrast");

    brightnessContrastEffect.property("Brightness").setValue(0);

    brightnessContrastEffect.property("Contrast").setValue(0);


    // Get the brightness value of the solid layer

    var brightnessValue = brightnessContrastEffect.property("Brightness").value;


    // Store the brightness value in the array

    brightnessValues.push(brightnessValue);


    // Remove the temporary solid layer

    tempSolidLayer.remove();

  }


  return brightnessValues;

}



More Creators