docs: Improved README.md.

This commit is contained in:
Spencer Brower
2024-02-03 22:57:33 -05:00
parent 25a3868dca
commit 55d04eb66e
8 changed files with 113 additions and 7 deletions

7
Makefile Normal file
View File

@@ -0,0 +1,7 @@
README.md:
gomplate -f $@.tmpl --plugin 'filters=./get_filter_support_table,ffprobe=./get_ffprobe_commands_table' > $@
clean:
rm README.md
.PHONY: clean

View File

@@ -1,3 +1,4 @@
# nu-ffmpeg # nu-ffmpeg
Utility commands for working with ffmpeg in nushell. Utility commands for working with ffmpeg in nushell.
@@ -15,7 +16,7 @@ Utility commands for working with ffmpeg in nushell.
The `ffmpeg` and `ffprobe` commands are required to be installed and available The `ffmpeg` and `ffprobe` commands are required to be installed and available
in your path; they are not installed for you. in your path; they are not installed for you.
Currently nushell versions 0.87.0 - 0.88.1 are supported. Currently only nushell version 0.89.0 is supported.
After that, clone this repository and add the following code to your scripts, After that, clone this repository and add the following code to your scripts,
or to your `config.nu` file: or to your `config.nu` file:
@@ -24,3 +25,30 @@ or to your `config.nu` file:
use <path-to-repository>/ffprobe use <path-to-repository>/ffprobe
use <path-to-repository>/filters * use <path-to-repository>/filters *
``` ```
## FFProbe
### Commands
| name | usage |
| --------------------- | ---------------------------------------------------------------- |
| ffprobe | Run ffprobe on a list of files and return the output as a table. |
| ffprobe dimensions | Get the dimensions of a video stream |
| ffprobe streams | Retrieve all the streams from a list of ffprobe outputs |
| ffprobe streams audio | Retrieve all the audio streams from a list of ffprobe outputs |
| ffprobe streams video | Retrieve all the video streams from a list of ffprobe outputs |
## FFMpeg
## Supported Filters
| name | usage |
| ------- | -------------------------------------------------------------------------------------------------- |
| crop | Crop the input video to given dimensions. |
| fps | Convert the video to specified constant frame rate by duplicating or dropping frames as necessary. |
| loop | loop video frames |
| overlay | Overlay one video on top of another. |
| split | |
| vflip | Flip the input video vertically. |

44
README.md.tmpl Normal file
View File

@@ -0,0 +1,44 @@
{{ if false }}
<!--
vim: filetype=markdown :
->
{{ end }}
# nu-ffmpeg
Utility commands for working with ffmpeg in nushell.
## Capabilities
- Return tables from `ffprobe`
- `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
- Apply and parse complex filters to a video (Work In Progress)
## Setup
The `ffmpeg` and `ffprobe` commands are required to be installed and available
in your path; they are not installed for you.
Currently only nushell version 0.89.0 is supported.
After that, clone this repository and add the following code to your scripts,
or to your `config.nu` file:
```nu
use <path-to-repository>/ffprobe
use <path-to-repository>/filters *
```
## FFProbe
### Commands
{{ ffprobe }}
## FFMpeg
## Supported Filters
{{ filters }}

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env nu #!/usr/bin/env nu
# vim: filetype=nu : # vim: filetype=nu :
# Multimedia stream analyzer. # Run ffprobe on a list of files and return the output as a table.
export def main [ export def main [
...input_files: string ...input_files: string
]: nothing -> table { ]: nothing -> table {

6
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1704538339, "lastModified": 1705856552,
"narHash": "sha256-1734d3mQuux9ySvwf6axRWZRBhtcZA9Q8eftD6EZg6U=", "narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "46ae0210ce163b3cba6c7da08840c1d63de9c701", "rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -13,8 +13,7 @@
devShells.x86_64-linux.default = pkgs.mkShell { devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
ffmpeg ffmpeg
gomplate
sbcl
nushellFull nushellFull
]; ];

15
get_ffprobe_commands_table Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env -S nu -n
# vim: filetype=nu :
use ffprobe;
def main [] {
(
help commands
| where command_type == "custom" and name !~ "p(rompt|wd)"
| select name usage
| update name { if $in == 'main' { 'ffprobe' } else { $'ffprobe ($in)' } }
| filter { not ($in.name == 'ffprobe' and ($in.usage | is-empty)) }
| to md -p
)
}

13
get_filter_support_table Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env -S nu -n
# vim: filetype=nu :
use filters.nu;
def main [] {
(
help commands
| where command_type == "custom" and name !~ "p(rompt|wd)|^main$"
| select name usage
| to md -p
)
}