mirror of
https://github.com/sbrow/nu-ffmpeg.git
synced 2025-12-29 16:23:11 -05:00
docs: Added *more* examples to README.md.
This commit is contained in:
@@ -7,5 +7,9 @@ plugins:
|
||||
ffprobe: ./get_ffprobe_commands_table
|
||||
version: ./nu_version
|
||||
ffprobe_example: ./examples/ffprobe.nu
|
||||
pluginTimeout: 10s
|
||||
ffprobe_multiple_files_example: ./examples/ffprobe-multiple-files.nu
|
||||
ffprobe_streams_audio_example: ./examples/streams-audio.nu
|
||||
ffprobe_streams_video_example: ./examples/streams-video.nu
|
||||
ffprobe_dimensions_example: ./examples/dimensions.nu
|
||||
#pluginTimeout: 10s
|
||||
|
||||
|
||||
7
Makefile
7
Makefile
@@ -2,12 +2,15 @@ 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
|
||||
README.md: examples/videos/sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 examples/videos/sample-videos.com/video321/mkv/720/big_buck_bunny_720p_1mb.mkv
|
||||
gomplate --config .gomplate.yml
|
||||
|
||||
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
|
||||
|
||||
examples/videos/sample-videos.com/video321/mkv/720/big_buck_bunny_720p_1mb.mkv:
|
||||
wget -x -P examples/videos https://sample-videos.com/video321/mkv/720/big_buck_bunny_720p_1mb.mkv
|
||||
|
||||
clean:
|
||||
rm -f README.md
|
||||
|
||||
|
||||
48
README.md
48
README.md
@@ -23,8 +23,56 @@ Utility commands for working with ffmpeg in nushell.
|
||||
```
|
||||
|
||||
- `ffprobe` multiple files at once
|
||||
```nu
|
||||
> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 https://sample-videos.com/video321/mkv/720/big_buck_bunny_720p_1mb.mkv
|
||||
╭────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────╮
|
||||
│ # │ 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 │ ... │ │ │
|
||||
│ │ ╰───┴────────────┴───────────────────────────────────────────┴─────────┴────────────┴──────────────────┴────────────┴─────╯ │ │
|
||||
│ 1 │ ╭───┬────────────┬─────────────────────────────┬────────────────┬────────────┬──────────────────┬───────────┬───────┬─────╮ │ ... │
|
||||
│ │ │ # │ codec_name │ codec_long_name │ profile │ codec_type │ codec_tag_string │ codec_tag │ width │ ... │ │ │
|
||||
│ │ ├───┼────────────┼─────────────────────────────┼────────────────┼────────────┼──────────────────┼───────────┼───────┼─────┤ │ │
|
||||
│ │ │ 0 │ mpeg4 │ MPEG-4 part 2 │ Simple Profile │ video │ [0][0][0][0] │ 0x0000 │ 1280 │ ... │ │ │
|
||||
│ │ │ 1 │ aac │ AAC (Advanced Audio Coding) │ LC │ audio │ [0][0][0][0] │ 0x0000 │ ❎ │ ... │ │ │
|
||||
│ │ ╰───┴────────────┴─────────────────────────────┴────────────────┴────────────┴──────────────────┴───────────┴───────┴─────╯ │ │
|
||||
╰────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────╯
|
||||
|
||||
```
|
||||
|
||||
- Use `streams`, `streams video`, and `streams audio` to filter `ffprobe` output
|
||||
|
||||
```nu
|
||||
> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 | streams video
|
||||
╭────┬─────────────┬────────────────────────────────────────────┬──────────┬─────────────┬───────────────────┬─────────────┬────────┬─────╮
|
||||
│ # │ codec_name │ codec_long_name │ profile │ codec_type │ codec_tag_string │ codec_tag │ width │ ... │
|
||||
├────┼─────────────┼────────────────────────────────────────────┼──────────┼─────────────┼───────────────────┼─────────────┼────────┼─────┤
|
||||
│ 0 │ h264 │ H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 │ Main │ video │ avc1 │ 0x31637661 │ 1280 │ ... │
|
||||
╰────┴─────────────┴────────────────────────────────────────────┴──────────┴─────────────┴───────────────────┴─────────────┴────────┴─────╯
|
||||
|
||||
> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 | streams audio
|
||||
╭────┬─────────────┬──────────────────────────────┬─────────┬────────────┬──────────────────┬────────────┬────────────┬─────────────┬─────╮
|
||||
│ # │ codec_name │ codec_long_name │ profile │ codec_type │ codec_tag_string │ codec_tag │ sample_fmt │ sample_rate │ ... │
|
||||
├────┼─────────────┼──────────────────────────────┼─────────┼────────────┼──────────────────┼────────────┼────────────┼─────────────┼─────┤
|
||||
│ 1 │ aac │ AAC (Advanced Audio Coding) │ LC │ audio │ mp4a │ 0x6134706d │ fltp │ 48000 │ ... │
|
||||
╰────┴─────────────┴──────────────────────────────┴─────────┴────────────┴──────────────────┴────────────┴────────────┴─────────────┴─────╯
|
||||
|
||||
```
|
||||
|
||||
- get the `dimensions` of a video stream as a record
|
||||
|
||||
```nu
|
||||
> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 | streams video | first | dimensions
|
||||
╭────────┬──────╮
|
||||
│ width │ 1280 │
|
||||
│ height │ 720 │
|
||||
╰────────┴──────╯
|
||||
|
||||
```
|
||||
- Tab-completion for filter options. i.e. `fps --round<tab>` will yield `zero inf down up near`
|
||||
- Apply and parse complex filters to a video (Work In Progress)
|
||||
|
||||
|
||||
@@ -17,8 +17,23 @@ Utility commands for working with ffmpeg in nushell.
|
||||
```
|
||||
|
||||
- `ffprobe` multiple files at once
|
||||
|
||||
```nu
|
||||
{{ ffprobe_multiple_files_example }}
|
||||
```
|
||||
|
||||
- Use `streams`, `streams video`, and `streams audio` to filter `ffprobe` output
|
||||
|
||||
```nu
|
||||
{{ ffprobe_streams_video_example }}
|
||||
{{ ffprobe_streams_audio_example }}
|
||||
```
|
||||
|
||||
- get the `dimensions` of a video stream as a record
|
||||
|
||||
```nu
|
||||
{{ ffprobe_dimensions_example }}
|
||||
```
|
||||
- Tab-completion for filter options. i.e. `fps --round<tab>` will yield `zero inf down up near`
|
||||
- Apply and parse complex filters to a video (Work In Progress)
|
||||
|
||||
|
||||
10
examples/dimensions.nu
Executable file
10
examples/dimensions.nu
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use ../ffprobe ["main" "dimensions" "streams video"];
|
||||
|
||||
# Extract the dimensions of a video stream
|
||||
def main [] {
|
||||
echo "> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 | streams video | first | dimensions"
|
||||
ffprobe $'($env.FILE_PWD)/videos/sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'
|
||||
| streams video | first | dimensions
|
||||
}
|
||||
13
examples/ffprobe-multiple-files.nu
Executable file
13
examples/ffprobe-multiple-files.nu
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use ../ffprobe;
|
||||
|
||||
# Use ffprobe on mutliple files at once
|
||||
def main [] {
|
||||
echo "> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 https://sample-videos.com/video321/mkv/720/big_buck_bunny_720p_1mb.mkv"
|
||||
(
|
||||
ffprobe
|
||||
$'($env.FILE_PWD)/videos/sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'
|
||||
$'($env.FILE_PWD)/videos/sample-videos.com/video321/mkv/720/big_buck_bunny_720p_1mb.mkv'
|
||||
)
|
||||
}
|
||||
@@ -2,5 +2,8 @@
|
||||
|
||||
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'
|
||||
# Return a table from ffprobe
|
||||
def main [] {
|
||||
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'
|
||||
}
|
||||
|
||||
10
examples/streams-audio.nu
Executable file
10
examples/streams-audio.nu
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use ../ffprobe ["main" "streams audio"];
|
||||
|
||||
# Extract the audio streams from a video
|
||||
def main [] {
|
||||
echo "> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 | streams audio"
|
||||
ffprobe $'($env.FILE_PWD)/videos/sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'
|
||||
| streams audio
|
||||
}
|
||||
10
examples/streams-video.nu
Executable file
10
examples/streams-video.nu
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use ../ffprobe ["main" "streams video"];
|
||||
|
||||
# Extract the video streams from a video
|
||||
def main [] {
|
||||
echo "> ffprobe https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 | streams video"
|
||||
ffprobe $'($env.FILE_PWD)/videos/sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'
|
||||
| streams video
|
||||
}
|
||||
Reference in New Issue
Block a user