skweez.net

Alles skweez?

1001111101100010111010001111000

Alles zu “flv”

28.02.2010

flv zu mp3 umwandeln in Bash|Convert flv to mp3 using Bash

von elm.

[lang_de]Ein Freund hat vor kurzem ein Skript gebastelt, mit dem man einfach .flv-Dateien zu .mp3-Dateien umwandeln kann. Das ist nützlich, wenn man z.B. Lieder von Youtube als .mp3 speichern will. In dem Skript wird die Lautstärke gleich via mp3gain angepasst und der Title und Interpret wird als ID3-Tag dazu geschrieben. Damit man das Skript komfortabel aufrufen kann, speichert man es am Besten in einem Pfad, der in $PATH steht. Meistens kann man /usr/local/bin/ nehmen. Dann braucht man zum Beispiel es nur noch mit folgendem Befehl aufrufen.[/lang_de]

[lang_en]A friend of mine made a script, you can use to convert .flv to .mp3 files, e.g. for extracting songs from Youtube videos. The script also adjusts the volume using mp3gain and the title and interpret are added as ID3-Tag. To use the script comfortably, you should save it to a folder that’s in the $PATH of your system. The folder /usr/local/bin/ should work for most people. You can then call the script like that:[/lang_en]

$ flv2mp3 musik.flv lied.mp3 "best song ever" "best band ever"

[lang_de]Das Skript steht unter der Bierlizenz.[/lang_de]

[lang_en]You may use it under the Beerware license.[/lang_en]

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
#!/bin/bash
 
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# wagges wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. -- wagges
# ----------------------------------------------------------------------------
 
if [ $# -ne "4" ] then
	echo "This script converts flv videos to mp3 audiofiles via ffmpeg,
and sets volume to 98dB with mp3gain and finally edits ID3-Tags
 
needed packages:	mp3gain ffmpeg id3v2
usage:			flv2mp3 INPUTFILE OUTPUTFILE (with .mp3 at the end) TITLE ARTIST"
	echo
	exit
fi
echo -e "\nconverting to mp3 via ffmpeg\n"
 
ffmpeg -i "$1" -f mp3 -ab 160000 -acodec libmp3lame "$2"
 
echo -e "\nconverting done. adjusting audio volume via mp3gain ...\n"
 
mp3gain -d 6 "$2"
 
echo -e "\nvolume adjustment done. Writing TAGs ...\n"
 
id3v2 -t "$3" -a "$4" "$2"
 
echo -e "\ndone\n"