diff --git a/.gitignore b/.gitignore index 92b2793..bea5a9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .direnv +examples/videos/** diff --git a/.gomplate.yml b/.gomplate.yml new file mode 100644 index 0000000..202582f --- /dev/null +++ b/.gomplate.yml @@ -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 + diff --git a/Makefile b/Makefile index 0eadbdb..456f985 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 8c0a45d..e9d3d6e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/README.md.tmpl b/README.md.tmpl index 7076f82..469228b 100644 --- a/README.md.tmpl +++ b/README.md.tmpl @@ -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 diff --git a/examples/ffprobe.nu b/examples/ffprobe.nu new file mode 100755 index 0000000..80cf7a5 --- /dev/null +++ b/examples/ffprobe.nu @@ -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'