initial commit

This commit is contained in:
Denis Lehmann 2022-01-09 21:57:12 +01:00
commit b15abdedcb
5 changed files with 272 additions and 0 deletions

102
README.org Normal file
View file

@ -0,0 +1,102 @@
* ffutils
This is a collection of ffmpeg wrapper scripts:
| [[#ffconv][=ffconv=]] | Convert multiple media files from one format to another |
| [[#ffcut][=ffcut=]] | Extract a part of a media file |
** 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 (see *Usage* below).
**** 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 d
irectory)
-k, --keep Keep original files
-l, --list List files which match the FROM_FORMAT
-m, --move DIRECTORY Move old files to DIRECTORY (omits --keep) (default
: )
EXAMPLES
ffconv mp3 opus Convert all mp3 files to opus
ffconv -m trash mp4 mkv Convert all mp4 to mkv and move the original one
s to './trash'
ffconv -d ~/music -l wma mp3 List all wma files from '~/music' and ask for co
nverting 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.
The cutted file will be saved as cutted_<filename>.
POSITIONAL ARGUMENTS
FILE File which will be cutted
OPTIONS
-f, --from TIMESTAMP/SECONDS Extract from TIMESTAMP/SECONDS (default: 0)
-t, --to TIMESTAMP/DURATION Extract to TIMESTAMP/DURATION (default: end)
EXAMPLES
ffcut -t 5 video.mp4 Extract the first five seconds of 'vi
deo.mp4'
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