en-US/VideoTools.psm1-Help.xml

<?xml version='1.0' encoding='utf-8'?>
<helpItems xmlns="http://msh" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:maml="http://schemas.microsoft.com/maml/2004/10" schema="maml">
  <command:command>
    <command:details>
      <command:name>New-VideoConversion</command:name>
      <maml:description>
        <maml:para>Creates a VideoConversion from existing metadata or a media file.</maml:para>
      </maml:description>
      <command:verb>New</command:verb>
      <command:noun>VideoConversion</command:noun>
    </command:details>
    <maml:description>
      <maml:para>Reuses a VideoFile or probes a supplied file and initializes a conversion model. A conversion model stores settings; creating one does not encode or create an output file. UpdateCommandLine takes a resolved request and returns FFmpeg arguments, without running FFmpeg. Specify paths and stream selections in that request; setting model properties alone does not populate it.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>New-VideoConversion</maml:name>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>InputVideo</maml:name>
          <command:parameterValue required="true">VideoFile</command:parameterValue>
          <dev:type>
            <maml:name>VideoFile</maml:name>
          </dev:type>
        </command:parameter>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>WhatIf</maml:name>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
          </dev:type>
        </command:parameter>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>Confirm</maml:name>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
          </dev:type>
        </command:parameter>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>OutputPath</maml:name>
          <command:parameterValue required="true">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
          </dev:type>
        </command:parameter>
      </command:syntaxItem>
      <command:syntaxItem>
        <maml:name>New-VideoConversion</maml:name>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>VideoFile</maml:name>
          <command:parameterValue required="true">FileInfo</command:parameterValue>
          <dev:type>
            <maml:name>FileInfo</maml:name>
          </dev:type>
        </command:parameter>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>WhatIf</maml:name>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
          </dev:type>
        </command:parameter>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>Confirm</maml:name>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
          </dev:type>
        </command:parameter>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>OutputPath</maml:name>
          <command:parameterValue required="true">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
          </dev:type>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters>
      <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
        <maml:name>InputVideo</maml:name>
        <maml:description>
          <maml:para>An existing VideoFile. Its metadata is reused without another file probe.</maml:para>
        </maml:description>
        <command:parameterValue required="true">VideoFile</command:parameterValue>
        <dev:type>
          <maml:name>VideoFile</maml:name>
        </dev:type>
      </command:parameter>
      <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
        <maml:name>WhatIf</maml:name>
        <maml:description>
          <maml:para>Shows what the command would do.</maml:para>
        </maml:description>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
        </dev:type>
      </command:parameter>
      <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
        <maml:name>Confirm</maml:name>
        <maml:description>
          <maml:para>Prompts for confirmation before running the operation.</maml:para>
        </maml:description>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
        </dev:type>
      </command:parameter>
      <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
        <maml:name>VideoFile</maml:name>
        <maml:description>
          <maml:para>An existing media file to probe. A nonexistent file produces no conversion object; invalid media and probe failures can throw.</maml:para>
        </maml:description>
        <command:parameterValue required="true">FileInfo</command:parameterValue>
        <dev:type>
          <maml:name>FileInfo</maml:name>
        </dev:type>
      </command:parameter>
      <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
        <maml:name>OutputPath</maml:name>
        <maml:description>
          <maml:para>Sets the output path on the conversion model. Supply OutputPath in the resolved request when building arguments.</maml:para>
        </maml:description>
        <command:parameterValue required="true">String</command:parameterValue>
        <dev:type>
          <maml:name>String</maml:name>
        </dev:type>
      </command:parameter>
    </command:parameters>
    <command:inputTypes>
      <command:inputType>
        <dev:type>
          <maml:name>None</maml:name>
        </dev:type>
        <maml:description>
          <maml:para>This command takes no pipeline input.</maml:para>
        </maml:description>
      </command:inputType>
    </command:inputTypes>
    <command:returnValues>
      <command:returnValue>
        <dev:type>
          <maml:name>VideoConversion</maml:name>
        </dev:type>
      </command:returnValue>
    </command:returnValues>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$VO = New-VideoFile -VideoFile (Get-Item -LiteralPath 'C:\Videos\sample.mp4')
$VOt = New-VideoConversion -InputVideo $VO -OutputPath '.\converted.mkv'
$VOt | Select-Object OutputPath, Resolution, OutputVideoCodec</dev:code>
        <dev:remarks>
          <maml:para>Reuses a probed file to initialize a conversion. No output is written.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$VOt = New-VideoConversion -VideoFile (Get-Item -LiteralPath 'C:\Videos\sample.mp4')
$VOt.InputVideo | Select-Object VideoCodecName, Resolution</dev:code>
        <dev:remarks>
          <maml:para>Probes the file and creates the model in one call. Use InputVideo instead if you already have a VideoFile and want to avoid another probe.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$source = Get-Item -LiteralPath 'C:\Videos\sample.mp4'
$VO = New-VideoFile -VideoFile $source
$VOt = New-VideoConversion -InputVideo $VO
$request = @{
    InputPath = $source.FullName
    OutputPath = Join-Path $source.DirectoryName 'sample-copy.mkv'
    VideoStream = $VO.VideoStreamId
    Encoder = 'copy'
    AudioStream = $VO.AudioStreamId
    AudioCodec = 'copy'
}
$VOt.UpdateCommandLine($request)</dev:code>
        <dev:remarks>
          <maml:para>Previews a stream-copy command using the selected video and audio streams. An AudioStream value of -1 omits audio. No encoding is started; choose a container compatible with the copied streams.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 4 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$source = Get-Item -LiteralPath 'C:\Videos\sample.mp4'
$VO = New-VideoFile -VideoFile $source
$VOt = New-VideoConversion -InputVideo $VO
$request = @{
    InputPath = $source.FullName
    OutputPath = Join-Path $source.DirectoryName 'sample-half.mkv'
    VideoStream = $VO.VideoStreamId
    Encoder = 'libx264'
    AudioStream = -1
    Filters = '-vf scale=iw/2:ih/2'
    PixelFormat = '-pix_fmt yuv420p'
    Preset = 'fast'
}
$VOt.UpdateCommandLine($request)</dev:code>
        <dev:remarks>
          <maml:para>Previews a software H.264 encode at half resolution, omitting audio. Use dimensions divisible by four and an FFmpeg build with libx264. This only formats arguments; running FFmpeg is a separate step.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 5 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$source = Get-Item -LiteralPath 'C:\Videos\sample.mp4'
$VO = New-VideoFile -VideoFile $source
$track = $VO.AudioTracks | Select-Object -First 1
if (!$track) { throw 'The input has no audio track.' }
$VOt = New-VideoConversion -InputVideo $VO
$request = @{
    InputPath = $source.FullName
    OutputPath = Join-Path $source.DirectoryName 'sample-audio.mkv'
    VideoStream = $VO.VideoStreamId
    Encoder = 'copy'
    AudioTracks = @(@{ StreamIndex = $track.StreamIndex; Enabled = $true; Encoder = 'copy' })
}
$VOt.UpdateCommandLine($request)</dev:code>
        <dev:remarks>
          <maml:para>Previews copying the video and only the first audio track. AudioTracks is an explicit selection: an empty array selects no audio. Choose track indices from the current file, not from a different input.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 6 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>New-VideoConversion -VideoFile (Get-Item -LiteralPath 'C:\Videos\sample.mp4') -WhatIf</dev:code>
        <dev:remarks>
          <maml:para>Preview the constructor call without probing the file or creating a conversion model.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <maml:relatedLinks>
      <maml:navigationLink>
        <maml:linkText>about_VideoTools</maml:linkText>
      </maml:navigationLink>
    </maml:relatedLinks>
  </command:command>
  <command:command>
    <command:details>
      <command:name>New-VideoFile</command:name>
      <maml:description>
        <maml:para>Creates a VideoFile, optionally probing a video file.</maml:para>
      </maml:description>
      <command:verb>New</command:verb>
      <command:noun>VideoFile</command:noun>
    </command:details>
    <maml:description>
      <maml:para>With a file, reads video properties and the stream inventory using FFprobe. Frame counting can require a scan or a MediaInfo fallback. The probe is synchronous and can throw for a missing tool, invalid file, or missing playable video stream. Without a file, creates an empty model without probing. Use the generic probe in about_VideoTools for audio-only or subtitle-only input.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>New-VideoFile</maml:name>
        <command:parameter required="false" position="0" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>VideoFile</maml:name>
          <command:parameterValue required="true">FileInfo</command:parameterValue>
          <dev:type>
            <maml:name>FileInfo</maml:name>
          </dev:type>
        </command:parameter>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>WhatIf</maml:name>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
          </dev:type>
        </command:parameter>
        <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
          <maml:name>Confirm</maml:name>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
          </dev:type>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters>
      <command:parameter required="false" position="0" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
        <maml:name>VideoFile</maml:name>
        <maml:description>
          <maml:para>An existing media file, supplied as a FileInfo or a path PowerShell converts to one. The file must contain a playable video stream.</maml:para>
        </maml:description>
        <command:parameterValue required="true">FileInfo</command:parameterValue>
        <dev:type>
          <maml:name>FileInfo</maml:name>
        </dev:type>
      </command:parameter>
      <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
        <maml:name>WhatIf</maml:name>
        <maml:description>
          <maml:para>Shows what the command would do.</maml:para>
        </maml:description>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
        </dev:type>
      </command:parameter>
      <command:parameter required="false" position="named" pipelineInput="false" globbing="false" variableLength="false" aliases="none">
        <maml:name>Confirm</maml:name>
        <maml:description>
          <maml:para>Prompts for confirmation before running the operation.</maml:para>
        </maml:description>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
        </dev:type>
      </command:parameter>
    </command:parameters>
    <command:inputTypes>
      <command:inputType>
        <dev:type>
          <maml:name>None</maml:name>
        </dev:type>
        <maml:description>
          <maml:para>This command takes no pipeline input.</maml:para>
        </maml:description>
      </command:inputType>
    </command:inputTypes>
    <command:returnValues>
      <command:returnValue>
        <dev:type>
          <maml:name>VideoFile</maml:name>
        </dev:type>
      </command:returnValue>
    </command:returnValues>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$VO = New-VideoFile
$VO | Select-Object VideoCodecName, Resolution, FrameCountSource</dev:code>
        <dev:remarks>
          <maml:para>Creates an empty model. It does not open a file or run FFprobe.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$VO = New-VideoFile -VideoFile (Get-Item -LiteralPath 'C:\Videos\sample.mp4')
$VO | Select-Object VideoCodecName, Resolution, FPS, LengthSec, TotalFrames, FrameCountSource</dev:code>
        <dev:remarks>
          <maml:para>Reads a video and displays its codec, dimensions, frame rate, duration in seconds and frame count. A count of zero with source Unknown is not a confirmed count. Counting may take longer than reading metadata.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 3 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$VO = New-VideoFile -VideoFile (Get-Item -LiteralPath 'C:\Videos\sample.mp4')
$VO.Streams | Format-Table StreamIndex, Type, Codec, Language, Title
$VO.AudioTracks | Format-Table StreamIndex, Codec, Language, Channels, Default
$VO.SubtitleTracks | Format-Table StreamIndex, Codec, Language, Forced</dev:code>
        <dev:remarks>
          <maml:para>Inspects all streams and the audio and subtitle collections. StreamIndex is the index in this input file; inspect each input before selecting tracks.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 4 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>Get-ChildItem -LiteralPath 'C:\Videos' -File -Filter '*.mp4' | ForEach-Object {
    $VO = New-VideoFile -VideoFile $_
    [pscustomobject]@{
        File = $_.Name
        Resolution = $VO.Resolution
        DurationSeconds = $VO.LengthSec
        AudioTracks = @($VO.AudioTracks).Count
    }
}</dev:code>
        <dev:remarks>
          <maml:para>Builds one summary per MP4 file. Each call probes the file; the command does not accept pipeline input directly. Errors are not silently skipped.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 5 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>New-VideoFile -VideoFile (Get-Item -LiteralPath 'C:\Videos\sample.mp4') -WhatIf</dev:code>
        <dev:remarks>
          <maml:para>Shows the operation without creating a model or probing the media.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 6 --------------------------</maml:title>
        <maml:introduction>
          <maml:para>PS&gt; </maml:para>
        </maml:introduction>
        <dev:code>$VO = New-VideoFile -VideoFile (Get-Item -LiteralPath 'C:\Videos\sample.mp4')
$VO.AudioTracks | Where-Object Default | Select-Object StreamIndex, Codec, Language</dev:code>
        <dev:remarks>
          <maml:para>Find audio streams marked as default in the source. A file can have no default audio stream.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <maml:relatedLinks>
      <maml:navigationLink>
        <maml:linkText>about_VideoTools</maml:linkText>
      </maml:navigationLink>
    </maml:relatedLinks>
  </command:command>
</helpItems>