"""
Video effects examples using FMUS-VID.
"""

import fmusvid
import numpy as np

def apply_color_effects():
    """Apply color-based effects."""
    video = fmusvid.load("input.mp4")

    # Efek warna dasar
    basic = (video
        .grayscale()                  # Konversi ke grayscale
        .brightness(1.2)              # Tingkatkan brightness
        .contrast(1.1)               # Sesuaikan contrast
        .saturation(0.8)             # Kurangi saturation
    )

    # Efek warna lanjutan
    advanced = (video
        .colorize(
            color=(0, 0, 255),        # Tint biru
            intensity=0.3             # Intensitas 30%
        )
        .temperature(6500)            # Sesuaikan color temperature
        .gamma(1.2)                   # Gamma correction
    )

    basic.save("basic_color.mp4")
    advanced.save("advanced_color.mp4")

def apply_filters():
    """Apply visual filters."""
    video = fmusvid.load("input.mp4")

    # Filter dasar
    basic = (video
        .blur(radius=2.0)             # Gaussian blur
        .sharpen(amount=1.5)          # Sharpen
        .denoise(strength=0.5)        # Noise reduction
    )

    # Filter artistik
    artistic = (video
        .vignette(
            intensity=0.3,            # Intensitas vignette
            feather=0.2               # Feathering amount
        )
        .film_grain(
            amount=0.1,               # Grain amount
            monochrome=True           # B&W grain
        )
        .lut("cinematic.cube")        # Apply color LUT
    )

    basic.save("basic_filters.mp4")
    artistic.save("artistic_filters.mp4")

def create_animations():
    """Create animated effects."""
    video = fmusvid.load("input.mp4")

    # Zoom effect
    zoom = video.animate(
        "scale",
        start=1.0,
        end=1.5,
        duration=5.0,
        easing="ease_in_out"
    )

    # Pan effect
    pan = video.animate(
        "position",
        start=(0, 0),
        end=(100, 0),
        duration=3.0,
        easing="linear"
    )

    # Rotate effect
    rotate = video.animate(
        "rotation",
        start=0,
        end=360,
        duration=4.0,
        easing="ease_out"
    )

    zoom.save("zoom_effect.mp4")
    pan.save("pan_effect.mp4")
    rotate.save("rotate_effect.mp4")
