mirror of
https://github.com/sbrow/nu-ffmpeg.git
synced 2025-12-29 16:23:11 -05:00
feat: Added ffmpeg examples.
This commit is contained in:
35
README.md
35
README.md
@@ -182,3 +182,38 @@ use <path-to-repository>/filters *
|
||||
|
||||
### Examples
|
||||
|
||||
```nu
|
||||
# Re-encode the video to 30fps
|
||||
(
|
||||
fmpeg cmd ['https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'] []
|
||||
| fps 30
|
||||
| ffmpeg run
|
||||
)
|
||||
|
||||
Would run:
|
||||
╭───┬────────────────────────────────────────────────────────────────────────╮
|
||||
│ 0 │ ffmpeg │
|
||||
│ 1 │ -i │
|
||||
│ 2 │ https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 │
|
||||
│ 3 │ -filter_complex │
|
||||
│ 4 │ fps=fps=30 │
|
||||
╰───┴────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
```nu
|
||||
# Re-encode the video to 30fps, specifying input and output streams
|
||||
(
|
||||
fmpeg cmd ['https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'] []
|
||||
| filterchain -i ['0'] -o ['video'] { fps 30 }
|
||||
| ffmpeg run
|
||||
)
|
||||
|
||||
Would run:
|
||||
╭───┬────────────────────────────────────────────────────────────────────────╮
|
||||
│ 0 │ ffmpeg │
|
||||
│ 1 │ -i │
|
||||
│ 2 │ https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4 │
|
||||
│ 3 │ -filter_complex │
|
||||
│ 4 │ [0]fps=fps=30[video] │
|
||||
╰───┴────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
@@ -69,3 +69,10 @@ use <path-to-repository>/filters *
|
||||
|
||||
### Examples
|
||||
|
||||
```nu
|
||||
{{ example "convert-to-30-fps" -}}
|
||||
```
|
||||
|
||||
```nu
|
||||
{{ example "convert-to-30-fps-with-filterchain" -}}
|
||||
```
|
||||
|
||||
25
examples/convert-to-30-fps-with-filterchain.nu
Executable file
25
examples/convert-to-30-fps-with-filterchain.nu
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env -S nu -n
|
||||
|
||||
use ../ffmpeg.nu;
|
||||
use ../ffmpeg.nu [filterchain];
|
||||
use ../filters.nu *;
|
||||
|
||||
# Re-encode the video to 30fps
|
||||
def main []: nothing -> any {
|
||||
print '# Re-encode the video to 30fps, specifying input and output streams'
|
||||
print '('
|
||||
print ' fmpeg cmd ['https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'] []'
|
||||
print " | filterchain -i ['0'] -o ['video'] { fps 30 }"
|
||||
print ' | ffmpeg run'
|
||||
print ')'
|
||||
print ''
|
||||
print 'Would run:'
|
||||
|
||||
(
|
||||
ffmpeg cmd ['https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'] []
|
||||
| filterchain -i ['0'] -o ['video'] { fps 30 }
|
||||
| ffmpeg cmd to-args
|
||||
| ['ffmpeg' ...$in]
|
||||
)
|
||||
}
|
||||
|
||||
24
examples/convert-to-30-fps.nu
Executable file
24
examples/convert-to-30-fps.nu
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env -S nu -n
|
||||
|
||||
use ../ffmpeg.nu;
|
||||
use ../filters.nu *;
|
||||
|
||||
# Re-encode the video to 30fps
|
||||
def main []: nothing -> any {
|
||||
print '# Re-encode the video to 30fps'
|
||||
print '('
|
||||
print ' fmpeg cmd ['https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'] []'
|
||||
print ' | fps 30'
|
||||
print ' | ffmpeg run'
|
||||
print ')'
|
||||
print ''
|
||||
print 'Would run:'
|
||||
|
||||
(
|
||||
ffmpeg cmd ['https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_1mb.mp4'] []
|
||||
| fps 30
|
||||
| ffmpeg cmd to-args
|
||||
| ['ffmpeg' ...$in]
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user