diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-06-21 22:36:34 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-06-21 22:36:34 +0530 |
commit | 42a5479fa8e66be2c550f64572c2befd8653bc8d (patch) | |
tree | 3fa277d2eb9f9e7b3848c1d3f124892fe35ce1bc /plugins/ringtone | |
parent | de2773c6774300fd37e6864db9184e606967c276 (diff) | |
download | nnn-42a5479fa8e66be2c550f64572c2befd8653bc8d.tar.gz |
Add an mp3 ringtone generator
Diffstat (limited to 'plugins/ringtone')
-rwxr-xr-x | plugins/ringtone | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/ringtone b/plugins/ringtone new file mode 100755 index 0000000..3b16edd --- /dev/null +++ b/plugins/ringtone @@ -0,0 +1,31 @@ +#!/usr/bin/env sh + +# Description: Create an mp3 ringtone out of an audio file in any format +# Needs user to provide start and end where to cut the file +# Input file audio.ext results in audio_ringtone.mp3 +# Requires: date, ffmpeg +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +if ! [ -z "$1" ]; then + echo -n "start (hh:mm:ss): " + read start + st=`date -d "$start" +%s` + + echo -n "end (hh:mm:ss): " + read end + et=`date -d "$end" +%s` + + if [ $st -ge $et ]; then + echo "error: start >= end" + exit 1 + fi + + interval=$(( $et - $st )) + + outfile=`basename "$1"` + outfile="${outfile%.*}"_ringtone.mp3 + + ffmpeg -i "$1" -ss "$start" -t "$interval" -vn -sn -acodec libmp3lame -q:a 2 "$outfile" +fi |