My build of nnn with minor changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
946 B

  1. #!/usr/bin/env sh
  2. # Description: Create an mp3 ringtone out of an audio file in any format
  3. # Needs user to provide start and end where to cut the file
  4. # Input file audio.ext results in audio_ringtone.mp3
  5. #
  6. # Tip: To convert a complete media file, set start as 0 and
  7. # the runtime of the file as end.
  8. #
  9. # Dependencies: date, ffmpeg
  10. #
  11. # Shell: POSIX compliant
  12. # Author: Arun Prakash Jana
  13. if [ -n "$1" ]; then
  14. printf "start (hh:mm:ss): "
  15. read -r start
  16. st=$(date -d "$start" +%s) || exit 1
  17. printf "end (hh:mm:ss): "
  18. read -r end
  19. et=$(date -d "$end" +%s) || exit 1
  20. if [ "$st" -ge "$et" ]; then
  21. printf "error: start >= end "
  22. read -r _
  23. exit 1
  24. fi
  25. interval=$(( et - st ))
  26. outfile=$(basename "$1")
  27. outfile="${outfile%.*}"_ringtone.mp3
  28. ffmpeg -i "$1" -ss "$start" -t "$interval" -vn -sn -acodec libmp3lame -q:a 2 "$outfile"
  29. fi