107 lines
3.5 KiB
Org Mode
107 lines
3.5 KiB
Org Mode
* ffutils
|
|
|
|
This is a collection of ffmpeg wrapper scripts.
|
|
Currently the following scripts are available:
|
|
|
|
| [[#ffconv][ffconv]] | Convert multiple media files from one format to another |
|
|
| [[#ffcut][ffcut]] | Extract a part of a media file |
|
|
|
|
All are created with the [[https://github.com/Deleh/sf][sf]] script framework.
|
|
|
|
** Dependencies
|
|
|
|
- [[https://ffmpeg.org/][FFmpeg]]
|
|
|
|
** Installation
|
|
|
|
Grab a script and execute it.
|
|
|
|
This repo is also a [[https://nixos.wiki/wiki/Flakes][Nix Flake]].
|
|
You can directly start a script with the following command if you have at least version 2.4 of [[https://nixos.org/][Nix]] installed:
|
|
|
|
: $ nix run github:Deleh/ffutils#<script_name> -- --help
|
|
|
|
** Scripts
|
|
|
|
*** =ffconv=
|
|
:properties:
|
|
:custom_id: ffconv
|
|
:end:
|
|
|
|
=ffconf= converts multiple media files from one format to another.
|
|
This is done recursively so the files can be in any directory structure.
|
|
|
|
#+begin_example
|
|
$ ffconv mp3 opus
|
|
Converting 4 files from mp3 to opus
|
|
Processing file 4/4: Alphaville - Big in Japan
|
|
done
|
|
#+end_example
|
|
|
|
*Warning*: The default behavior removes the original files.
|
|
Use the =--keep= or =--move= flags to keep the original files or move them to another directory.
|
|
|
|
**** Usage
|
|
|
|
#+begin_example
|
|
Usage: ffconv [OPTIONS] FROM_FORMAT TO_FORMAT
|
|
|
|
Convert multiple media files from one format to another.
|
|
Subdirectories are visited recursively.
|
|
|
|
POSITIONAL ARGUMENTS
|
|
FROM_FORMAT From format
|
|
TO_FORMAT To format
|
|
|
|
OPTIONS
|
|
-d, --directory DIRECTORY Convert files in DIRECTORY (default: current work
|
|
directory)
|
|
-k, --keep Keep original files
|
|
-l, --list List files which match the FROM_FORMAT
|
|
-m, --move DIRECTORY Move old files to DIRECTORY (omits --keep)
|
|
-h, --help Show this help message and exit
|
|
|
|
EXAMPLES
|
|
ffconv mp3 opus Convert all mp3 files to opus
|
|
ffconv -m trash mp4 mkv Convert all mp4 to mkv and move the original
|
|
ones to './trash'
|
|
ffconv -d ~/music -l wma mp3 List all wma files from '~/music' and ask for
|
|
converting them to mp3
|
|
#+end_example
|
|
|
|
*** =ffcut=
|
|
:properties:
|
|
:custom_id: ffcut
|
|
:end:
|
|
|
|
=ffcut= extracts a part of a media file.
|
|
|
|
#+begin_example
|
|
$ ffcut --from 00:15:00 --to 00:16:30 video.mp4
|
|
Cutting file video.mp4
|
|
The extracted part was saved to cutted_video.mp4
|
|
#+end_example
|
|
|
|
**** Usage
|
|
|
|
#+begin_example
|
|
Usage: ffcut [OPTIONS] FILE
|
|
|
|
Extract a part of a file.
|
|
|
|
POSITIONAL ARGUMENTS
|
|
FILE File which will be cutted
|
|
|
|
OPTIONS
|
|
-f, --from TIMESTAMP/SECONDS Extract from TIMESTAMP/SECONDS (default: 0)
|
|
-o, --out FILE Save extracted part to FILE (default:
|
|
cutted_<filename>)
|
|
-t, --to TIMESTAMP/DURATION Extract to TIMESTAMP/DURATION (default: end)
|
|
-h, --help Show this help message and exit
|
|
|
|
EXAMPLES
|
|
ffcut -t 5 video.mp4 -o cut.webm Extract the first five seconds of
|
|
'video.mp4' to 'cut.webm'
|
|
ffcut -f 00:10:30 -t 00:14:15 video.mp4 Extract the part from 00:10:30 to
|
|
00:14:15 from 'video.mp4'
|
|
#+end_example
|