RoughDraft


A Fun PowerShell Module for Multimedia

Commands

RoughDraft is a fun PowerShell Module for Multimedia.

It provides pipeline-aware command to create, convert, query, edit, and join multimedia files.

RoughDraft -Media Commands

The core of RoughDraft are the -Media commands:

Name Description
Convert-Media Converts media between formats
Edit-Media Edits media files
Get-Media Gets media metadata
Join-Media Joins media files
New-Media Creates media files
Recieve-Media Receives media from devices
Set-Media Sets media metadata
Show-Media Shows media files
Split-Media Splits media files
Send-Media Broadcasts media

These commands are built atop of FFMpeg

All Media Commands are Extensible. See the list of extensions

Examples

Convert-Media

# Converts a Movie.mkv to MP4
Convert-Media .\Movie.mkv mp4 

# Converts an .mp4 file to an .mp3
Convert-Media .\Movie.mp4 .\Soundtrack.mp3 

# Get rid of flac files
Convert-Media .\Song.flac .mp3

# Convert all .flac files to .mp3
Get-ChildItem -Path $home\Music -Recurse |
    Where-Object Extension -eq '.flac' |
    Convert-Media .mp3

Edit-Media

# Adds a sepia effect to an .mp4
Edit-Media .\Movie.mp4 -Sepia

# Increases the audio by 4 decibals.
Edit-Media .\Song.mp3 -AudioGain 4db

Get-Media

# Get metadata about an mp3
Get-Media .\Song.mp3 

# Detect silences within a song
Get-Media .\Song.mp3 -SilenceDetect

# Gets metadata about a movie.
Get-Media .\Movie.mp4        

Join-Media

# Make a timelapse from a directory of pictures
dir *.jpg | Join-Media -OutputPath .\Timelapse.mp4 -Timelapse 

# Join an audio and video file
Join-Media -InputPath .\Silent.mp4, .\Soundtrack.mp3 -OutputPath .\Movie.mp4 

# Join mp3s into an album
dir *.mp3 | Join-Media -Output ..\Album.mp3 

# Join various video files into a longer movie
dir | Where-Object Extension -in '.mkv', '.mp4' | Join-Media -Output ..\Movie.mp4 

New-Media

# Create a red jpg
New-Media -Color Red -OutputPath .\Red.jpg 

# Create a 15 second cyan mp4 at 1080p
New-Media -Color Cyan -OutputPath .\Cyan.mp4 -Duration '00:00:05' -Resolution '1920x1080'

# Create an RGB test source
New-Media -TestSource rgbtestsrc -OutputPath .\rgbtestsrc.mp4 -Duration '00:00:10'  

Set-Media

# Set metadata about a video
Set-Media .\Movie.mp4 -Property @{title='My Movie'}

# Sets metadata about a music file.
Set-Media .\Song.mp3 -Property @{title='My Song';artist='me';'lyrics-eng' = 'My Lyrics'}

# Sets album artwork
Set-Media .\Song.mp3 -AlbumArt .\Cover.jpg

Additional RoughDraft commands:

Name Description
ConvertTo-Gif Converts video to high-quality GIFs
ConvertTo-Waveform Converts audio to visualizations
Get-FFMpeg Gets FFMpeg
Get-FFPlay Gets FFPlay
Get-FFProbe Gets FFProbe
Get-FFProbe Uses FFProbe directly
Get-RoughDraftExtension Gets RoughDraftExtensions
Use-FFMpeg Uses FFMpeg directly
Use-FFPlay Uses FFPlay directly
Use-FFProbe Uses FFProbe directly

Additional examples:

# List available codecs
Get-FFMpeg -ListCodec         

# List available codecs
Get-FFMpeg -ListCaptureDevice 

# List available filters
Get-FFMpeg -ListFilter

# Get information about a filter 
Get-FFMpeg -FilterName

RoughDraft Extensions

RoughDraft uses Extensions to make complex media scenarios easier work with.

DisplayName Synopsis Extends
AlbumArt Sets album artwork Set-Media
AmplifyPixel AmplifyPixel extension Show-Media,Edit-Media
AudioCrusher Audio Crusher Show-Media,Edit-Media
AudioExpression Evaluates Audio Expressions Show-Media,Edit-Media,New-Media
AudioGain Increases audio volume Show-Media,Edit-Media
BilateralSmooth Bilateral Smooth Show-Media,Edit-Media
BlackDetect Detect black periods in a video. Get-Media
BlackFrame Detects black frames. Get-Media
BlendFrame BlendFrame Extension Show-Media,Edit-Media
BlendVideo BlendVideo Extension Join-Media
Blur Blurs Video Show-Media,Edit-Media
CaptureDevice Gets capture devices Get-FFMpeg
Chorus chorus Show-Media,Edit-Media
Codecs Lists codecs Get-FFMpeg
ColorContrast ColorContrast Extension Show-Media,Edit-Media
ColorHold ColorHold Extension Show-Media,Edit-Media
Colorize Colorize a video stream Show-Media,Edit-Media
ColorScope Colorscope extension Show-Media,Edit-Media
ColorSource Generates a color New-Media,Show-Media
Convolve convolve Join-Media
Crop Crop Extension Show-Media,Edit-Media,Send-Media,Receive-Media
CropDetect Auto-detect the crop size. Get-Media
DataScope Datascope effect Edit-Media
Deconvolve deconvolve Join-Media
DirectShow DirectShow Extension Show-Media,Send-Media,Receive-Media
DrawSubtitle Draw subtitles on top of input video Edit-Media,Convert-Media
DrawText Draws Text on Video Show-Media,Edit-Media
Echo Adds echoes to audio Show-Media,Edit-Media
EdgeDetect EdgeDetect Extension Show-Media,Edit-Media
Emboss Embosses video or images Edit-Media
Exposure Exposure Extension Show-Media,Edit-Media
FadeIn Fades in video Edit-Media
FillBorder Fill Borders. Show-Media,Edit-Media
FilterInput Gets filter details Get-FFMpeg
Flanger Audio Flanger. Show-Media,Edit-Media
FlipHorizontal Flips video horizontally Show-Media,Edit-Media
FlipVertical Flips video vertically Show-Media,Edit-Media
FrameBuffer FrameBuffer Extension Show-Media,Send-Media,Receive-Media
FrameStep FrameStep Effect Show-Media,Edit-Media
Histogram Histogram Extension Show-Media,Edit-Media
Hue Hue Extension Show-Media,Edit-Media
Hysteresis Hysteresis Join-Media
LagFun Slowly update darker pixels. Show-Media,Edit-Media
Life Generates life New-Media,Show-Media
LimitPixel Limits Pixel values Show-Media,Edit-Media
ListFilters Lists filters Get-FFMpeg
ListProtocols Lists protocols Get-FFMpeg
Mandelbrot Generates fractals New-Media,Show-Media
MedianPixel Picks median pixels Show-Media,Edit-Media
Mirror Mirror Extension Show-Media,Edit-Media
MixAudio Mix Audio Join-Media
Monochrome Make video monochrome Edit-Media
NoAudio Removes Audio Split-Media
Overlay overlay Join-Media
Phaser Audio Phaser Show-Media,Edit-Media
Pixelate Pixelate effect Edit-Media
Playlist Creates a playlist Join-Media
Pulsator Pulsator Effect Show-Media,Edit-Media
RandomizeFrame RandomizeFrame extensions Show-Media,Edit-Media
Rate Adjusts the rate of media. Show-Media,Edit-Media
Resize Resizes a video Show-Media,Edit-Media,Convert-Media
ReverseAudio Reverses audio Edit-Media
ReverseVideo Reverses video Edit-Media
Rotate Rotates a video Show-Media,Edit-Media,Convert-Media
ScrollVideo Scrolls video Show-Media,Edit-Media
Sepia Applies a Sepia Filter Edit-Media
ShowFrequency Show Frequencies Show-Media,Edit-Media,New-Media
ShowScale Show the tonal scale of the audio Show-Media,Edit-Media,New-Media
ShowSpectrum Shows the audio spectrum Show-Media,Edit-Media,New-Media
ShowVectorScope Shows a Vector Scope of the Audio Show-Media,Edit-Media,New-Media
ShowVolume Shows the volume of an audio stream. Show-Media,Edit-Media,New-Media
ShowWaveform Shows audio waveform. Show-Media,Edit-Media,New-Media
ShuffleFrames Shuffles frames in video Edit-Media
Sierpinski Generates a Sierpinski fractal New-Media,Show-Media
SilenceDetect Detects silence in an audio stream Get-Media
SilenceRemove Detects silence in an audio stream Edit-Media
Sine Generates a sine wave New-Media
Skew Skew Extension Show-Media,Edit-Media
SubFrequencyCut Cut subwoofer frequencies Show-Media,Edit-Media
Subtitler Creates subtitles. New-Media
SuperEqualizer Audio 18 band Superequalizer Show-Media,Edit-Media
SuperFrequencyCut Cut super frequencies. Show-Media,Edit-Media
TestSource Generates test sources New-Media,Show-Media
Tile Tile Extension Edit-Media
TimeMix Mix successive video frames. Show-Media,Edit-Media
Tremolo Tremolo effect Show-Media,Edit-Media
Vibrato Vibrato effect Show-Media,Edit-Media
VideoExpression Evaluates Video Expressions Show-Media,Edit-Media
VideoForLinux VideoForLinux Extension Show-Media,Send-Media,Receive-Media
Vignette Applies a vignette filter Show-Media,Edit-Media
VolumeLevel Gets VolumeLevels Get-Media
Watermark Watermarks a video Edit-Media
YouTubeDL Youtube Downloader Get-Media

Extending RoughDraft

RoughDraft is built extensibly. This is so that complex FFMpeg operations can be abstracted into small amounts of code.

You can see the current set of extensions with:

Get-RoughDraftExtension

Extension Scripts

Extensions are simple scripts files named with the regular expression \.(rd|RoughDraft)\.(ext|extension)\.ps1$.

They can exist in any module that adds the tag “RoughDraft”.

Extensions should include the following attributes above their parameter block:

# It's an extension
[Runtime.CompilerServices.Extension()]
# that extends Edit-Media            
# (Change this to indicate which command you'd like to extend)
# (Add additional Cmdlet attributes one to extend more commands)
[Management.Automation.Cmdlet("Edit","Media")] 
# that is inherited (this is the default).
# (an extension that is 'Inherited' will return control to the main function when it is done.)
# (an extension that is 'NotInherited' will run and return directly)
[ComponentModel.Inheritance("Inherited")]
param(
# At least one parameter of the extension should be mandatory.
[switch]
$MyEditExtension
)

Commands that can be extended:

The following commands can currently be extended: