blob: 9353862a06cd1e7ae4f847e318f388bb326bc4b5 (
plain)
1 Scripting Wma to Ogg Conversion in Linux
2 ========================================
3 :author: Aaron Ball
4 :email: nullspoon@iohq.net
5
6
7 == {doctype}
8
9 It's hard for me to believe that I used to be a Microsoft/Windows fanboy. I
10 used all their products and signed up for all their beta programs. Now, I'm a
11 full time Linux user and open source fanboy (which happens to be a bit of an
12 understatement). In my transition from Windows to Linux though, one thing I
13 delayed doing was converting my music library to a non-proprietary format
14 (wma). A few months back though, I finally decided to make the jump. After
15 investigating, I finally decided on using ogg as my final format. I went back
16 and re-ripped all of my old CDs, but there were some I couldn't find, so I
17 needed to convert the wma files to ogg. Now, there is the unfortunate downside
18 of converting a compressed format to a compressed format, so I converted to a
19 very high quality ogg format in my script to hopefully not lose too much (so
20 far everything sounds pretty good).
21
22 [[requirements]]
23 == Requirements
24
25 All you need for this is oggenc and mplayer (yay).
26
27
28 [[the-script]]
29 == The script
30
31 ----
32 #!/bin/bash
33 for file in ./*.wma; do
34 wavname=${file%.wma}.wav;
35 wavname=${wavname:2};
36 mplayer "$file" -ao pcm:file="$wavname";
37 oggname=${wavname%.wav}.ogg;
38 oggenc "$wavname" "$oggname";
39 rm "$wavname";
40 done
41 ----
42
43
44 [[what-just-happened]]
45 == What just happened?
46
47 So what we just did was start up a for loop for each file in the working
48 directory that ends with wma (*). Once we've done that, we remove the
49 ridiculously large wav file leaving us with only the original wma and the
50 converted ogg for your (hopefully positive) comparison.
51
52
53 Category:Linux
54 Category:Music
55
56
57 // vim: set syntax=asciidoc:
|