ubuntuusers.de

Anhang: convert2ogg-vorbis.sh

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
#!/bin/bash

## This script converts audio- and videofiles to ogg-vorbis-files.
## For decode you need "mplayer". For encode you need "vorbis-tools".
## For the graphical dialogues you also need "zenity".
## Dieses Skript wandelt Audio- und Videodateien in Ogg-Vorbis-Dateien um.
## Zum Dekodieren brauchst Du "mplayer". Zum Kodieren brauchst Du "vorbis-tools".
## Für die grafischen Dialoge benötigst Du "zenity".

## copyright (C) 2009 Til Til
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  
## USA

#set -x

version="0.1.0"
#################################################
#       TRADUCTIONS
        ###### Default = English #####
        title="convert2ogg-vorbis "$version""

tmppcm=/tmp/pcm$$.wav
quiet=no

report() {
#  if [ "$quiet" = "no" ]
#  then
#    if [ "$1" = "-n" ]
#    then 
#      shift
#      echo -n $*
#    else
#      echo $*
#    fi
#  fi
if [ "$quiet" = "no" ]
  then
    if [ "$2" = "-n" ]
    then 
      shift
      echo -n $*
    else
      echo $*
    fi
  fi
}


if [ "$#" = 0 ]
then
  fs=`find . -name "*.*"`
else
  if [ "$1" = "-q" ] 
  then
    shift
    quiet=yes
  fi
  fs=$*
fi
f=$f
f=$fs
if find -samefile ${f%%.*}_2.ogg
then
  zenity --error --title="$title" --text=" error - ${f%%.*}_2.ogg already exists, don't want to overwrite, conversion was stoped."  | report -n " error - ${f%%.*}_2.ogg already exists, don't want to overwrite, conversion was stoped."
  exit
fi

for f in $fs ; 
do 
  rm -f ${tmppcm}
  report -n "$f: decode ... "
  mplayer -quiet -nojoystick -nolirc -ao  pcm:waveheader:file=${tmppcm} $f | zenity --progress --title="$title" --text=" $f: decode ..." --auto-close  --auto-kill; $f > /dev/null  
  if [ -f ${tmppcm} ]
  then
    report -n " done; encode ${f%%.*}_2.ogg "

    ## You want to get ogg? You need "vorbis-tools". With -b you can configure the bitrate. Standard is 112 (kbps).
    ## Du möchtest ogg? Du benötigst "vorbis-tools". Mit -b kannst Du die Bitrate einstellen. Standard 112 (kbps).
    oggenc -b 112 ${tmppcm} -o ${f%%.*}_2.ogg 2>/dev/null | zenity --progress --title="$title" --text=" done; encode ${f%%.*}_2.ogg" --auto-close  --auto-kill

    rm -f ${tmppcm} | zenity --info --title="$f $title" --text=" conversion to ${f%%.*}_2.ogg finished" --timeout 3 | report " conversion to ${f%%.*}_2.ogg finished"
  else
    rm -f ${tmppcm}
    zenity --error --title="$title" --text=" error - $f not converted" | report " error - $f not converted"
  fi
done
exit
Anhang herunterladen

Skript für die einfache Benutzung im Dateimanager Nautilus mit Hilfe von nautilus-script-audio-convert zum Umwandeln von Audio- und Videodateien verschiedener Formate mit einem Mausklick in Ogg-Vorbis-Dateien.

Diese Revision wurde am 1. März 2011 18:08 von ubuntuusers erstellt.