docs: Added examples to README.md.

This commit is contained in:
Spencer Brower
2024-03-03 00:19:17 -05:00
parent 132e0c0bc8
commit fe06cbea26
6 changed files with 52 additions and 3 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
.direnv
examples/videos/**

11
.gomplate.yml Normal file
View File

@@ -0,0 +1,11 @@
inputFiles:
- README.md.tmpl
outputFiles:
- README.md
plugins:
filters: ./get_filter_support_table
ffprobe: ./get_ffprobe_commands_table
version: ./nu_version
ffprobe_example: ./examples/ffprobe.nu
pluginTimeout: 10s

View File

@@ -1,7 +1,17 @@
README.md:
gomplate -f $@.tmpl --plugin "filters=./get_filter_support_table,ffprobe=./get_ffprobe_commands_table,version=./nu_version" > $@
SHELL:=/nix/store/zicq9x6aznw7x202564p8iy0rm04py6l-nushell-0.89.0/bin/nu
all: README.md
README.md: examples/videos/sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4
gomplate --config .gomplate.yml -V
examples/videos/sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4:
wget -x -P examples/videos https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4
clean:
rm -f README.md
.PHONY: clean
clean-all: clean
rm -rf examples/videos/**
.PHONY: clean all

View File

@@ -6,6 +6,22 @@ Utility commands for working with ffmpeg in nushell.
## Capabilities
- Return tables from `ffprobe`
```nu
> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4
╭────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────╮
# │ streams │ ... │
├────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────┤
0 ╭───┬────────────┬───────────────────────────────────────────┬─────────┬────────────┬──────────────────┬────────────┬─────╮ ...
# │ codec_name │ codec_long_name │ profile │ codec_type │ codec_tag_string │ codec_tag │ ... │ │ │
├───┼────────────┼───────────────────────────────────────────┼─────────┼────────────┼──────────────────┼────────────┼─────┤
0 h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 Main video avc1 0x31637661 ...
1 aac AAC (Advanced Audio Coding) LC audio mp4a 0x6134706d ...
╰───┴────────────┴───────────────────────────────────────────┴─────────┴────────────┴──────────────────┴────────────┴─────╯
╰────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────╯
```
- `ffprobe` multiple files at once
- Use `streams`, `streams video`, and `streams audio` to filter `ffprobe` output
- get the `dimensions` of a video stream as a record

View File

@@ -11,6 +11,11 @@ Utility commands for working with ffmpeg in nushell.
## Capabilities
- Return tables from `ffprobe`
```nu
{{ ffprobe_example }}
```
- `ffprobe` multiple files at once
- Use `streams`, `streams video`, and `streams audio` to filter `ffprobe` output
- get the `dimensions` of a video stream as a record

6
examples/ffprobe.nu Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env nu
use ../ffprobe;
echo "> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4"
ffprobe $'($env.FILE_PWD)/videos/sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'