85 lines
3.9 KiB
Markdown
85 lines
3.9 KiB
Markdown
# Get-VideoInfo.ps1
|
|
|
|
Extracts and displays video metadata from the comment tag in a video file's format metadata. The displayed fields are driven by `Get-VideoInfo.ini` (display name → JSON field name). The script also probes the video stream with ffprobe and reports the actual encoded resolution and frame rate alongside the metadata when they differ. Fields mapped to `frames_count` in the INI are always read directly from ffprobe rather than from the JSON metadata.
|
|
|
|
## Parameters
|
|
|
|
- **`-Video`** (required): Path to input video file. Supports Windows wildcards (`*` and `?`) to match multiple files (e.g., `*.mp4`, `video?.mov`). When wildcards are used, metadata is extracted and displayed for each matching file sequentially, with separators between files.
|
|
- **`-Full`**: Output the parsed comment metadata as JSON (printed before the formatted block)
|
|
|
|
## Real vs metadata values
|
|
|
|
The script reads two pieces of information from ffprobe's video stream and uses them to enrich the formatted output:
|
|
|
|
- **Resolution**: any field whose value matches the `WxH` pattern (e.g. the metadata `resolution`) is shown with the actual encoded resolution appended when it differs — for example `Resolution: 720x1280 (real: 704x1280)`. WanGP / LTX-2 commonly record the requested resolution while the file is encoded at a slightly different size after the model's internal padding/cropping.
|
|
- **Frame rate / duration**: the duration of the `video_length` field is always computed from ffprobe's real frame rate (`r_frame_rate` of the first video stream). The JSON metadata's `force_fps` is intentionally ignored because some WanGP/LTX presets store non-numeric mode markers there (e.g. `"control"`). If ffprobe doesn't return a usable frame rate, the script falls back to 24 fps.
|
|
- **Actual frame count**: the `frames_count` field is always read directly from ffprobe (`nb_read_frames` of the first video stream) rather than from the JSON comment metadata. This gives the true encoded frame count of the file. Duration is computed using ffprobe's real frame rate, falling back to 24 fps if unavailable.
|
|
|
|
## Examples
|
|
|
|
**Display formatted metadata:**
|
|
|
|
```powershell
|
|
.\Get-VideoInfo.ps1 -Video video.mp4
|
|
```
|
|
|
|
Output example (metadata and actual resolution agree):
|
|
|
|
```text
|
|
----------------------------------------
|
|
File Name: video.mp4
|
|
Text Prompt: Perform accurate continuous lip sync with the spoken audio. A young woman is talking. Her lips, mouth and jaw move precisely and continuously in sync with every word and syllable of the spoken audio. Her teeth and tongue are visible as she speaks. Her lips never stop or freeze while the audio is playing.
|
|
Model: WanGP v10.9875 by DeepBeepMeep - LTX-2 2.3 Dev 22B
|
|
Resolution: 1280x720
|
|
Number of frames: 113 frames (4,7s, 24 fps)
|
|
Video Length: 113 frames (4,7s, 24 fps)
|
|
Seed: 153601012
|
|
Guidance: 4
|
|
Audio Guidance Scale: 7
|
|
Modality Guidance: 3
|
|
Guidance Rescale: 0,7
|
|
Num Inference Steps: 40
|
|
Creation Date: 2026-03-20 04:55:13
|
|
Generation Time: 1209s (20m 9s)
|
|
----------------------------------------
|
|
```
|
|
|
|
Output example (metadata resolution differs from the actual encoded resolution):
|
|
|
|
```text
|
|
----------------------------------------
|
|
File Name: 2026-05-31-12h25m16s_seed777652600_Remove the text from the foreground..mp4
|
|
Text Prompt: Remove the text from the foreground.
|
|
Model: WanGP v11.88 by DeepBeepMeep - LTX-2 2.3 Distilled 1.1 22B
|
|
Resolution: 720x1280 (real: 704x1280)
|
|
Number of frames: 185 frames (6,2s, 30 fps)
|
|
Video Length: 185 frames (6,2s, 30 fps)
|
|
...
|
|
----------------------------------------
|
|
```
|
|
|
|
**Display full JSON metadata:**
|
|
|
|
```powershell
|
|
.\Get-VideoInfo.ps1 -Video video.mp4 -Full
|
|
```
|
|
|
|
**Using relative paths:**
|
|
|
|
```powershell
|
|
.\Get-VideoInfo.ps1 -Video ..\videos\sample.mp4
|
|
```
|
|
|
|
**Process multiple files with wildcards:**
|
|
|
|
```powershell
|
|
.\Get-VideoInfo.ps1 -Video "*.mp4"
|
|
```
|
|
|
|
**Process files matching a pattern:**
|
|
|
|
```powershell
|
|
.\Get-VideoInfo.ps1 -Video "video?.mp4"
|
|
.\Get-VideoInfo.ps1 -Video "C:\Videos\Project_*_v1.mp4"
|
|
```
|