Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: arrgg!! mp3 to ogg script is not going well...

  1. #1

    arrgg!! mp3 to ogg script is not going well...

    ok - it works nicely if i don't have mp3s with spaces in the name, if i hvve spaces in the name then it no worky...

    Code:
    #!/bin/bash
    for i in `ls *.mp3`
    do
    mpg123 -w "$i".wav "@i"
    oggenc -q 7 -t "$i".wav
    rm "$i".wav
    done

  2. #2
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re:arrgg!! mp3 to ogg script is not going well...

    I have a similar problem. When we figure it out -- lets share. Mine has to do with making a little frontend to my mp3 player's interface. I hate typing all the crap in. Make a little script that handles it all.....

  3. #3

    Re:arrgg!! mp3 to ogg script is not going well...

    sounds groovy! i was hoping the quote marks would help, but no luck.

  4. #4
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re:arrgg!! mp3 to ogg script is not going well...

    How about:
    Code:
    #!/bin/bash
    for i in `ls *.mp3`
    do
      mpg123 -w "\"$i.wav\"" "\"@i\""
      oggenc -q 7 -t "\"$i.wav\""
      rm "\"$i.wav\""
    done

  5. #5

    Re:arrgg!! mp3 to ogg script is not going well...

    hum - no dice...
    also it should read
    $i, not @i in the mpg123 line...

    Code:
    #!/bin/bash
    for i in `ls *.mp3`
    do
    mpg123 -w "$i".wav "$i"
    oggenc "$i".wav
    rm "$i".wav
    done
    now this method is truely bad bad bad.

    my ogg files will wind up being named filename.mp3.ogg - anyone with a btter idea but not simply converting an mp3 to ogg with the perl method please let me know. i would like this to be as lossless as possible

  6. #6
    Guest

    Re:arrgg!! mp3 to ogg script is not going well...

    [quote author=pbharris link=board=9;threadid=4424;start=0#44031 date=1028159484]
    anyone with a btter idea but not simply converting an mp3 to ogg with the perl method please let me know. i would like this to be as lossless as possible
    [/quote]

    actually, if ur talking about the MP3::Info perl module that a lot of scripts use, it won't lose more quality than the way u are doing it now... in fact, most scripts do it the exact same way as u do except that they use that perl module so the ID3 tag of the mp3 gets converted to ogg vorbis headers (i'm not sure if it's called headers in ogg, but i thought i read it somewhere).

    oh, and the problem with spaces in the names, i had that too... turned out to be a problem with mpg123 as it can't handle spaces in the names. i'm affraid ur gonna have to rename ur files so they don't have spaces in them.

  7. #7

    Re:arrgg!! mp3 to ogg script is not going well...

    [quote author=pbharris link=board=9;threadid=4424;start=0#44031 date=1028159484]
    Code:
    #!/bin/bash
    for i in `ls *.mp3`
    do
    mpg123 -w "$i".wav "$i"
    oggenc "$i".wav
    rm "$i".wav
    done
    [/quote]

    Well, the first problem I see here is `ls *.mp3`. If you have spaces in your filenames, then your $i variable will be set to all the different fragments of the filenames, so you lose right from the get-go.

    I'm a little rusty with my bash (I use perl for everything ), but I believe that for i in *.mp3 will work as expected.

    Also, to fix your naming problems, you'll want to remove the .mp3 from the filename. Ultimately, you'll want something like this:

    Code:
    #!/bin/bash
    for i in *.mp3
    do
    name=$(echo $i|sed 's/\.mp3$//')
    mpg123 -w "$name.wav" "$i"
    oggenc "$name.wav"
    rm "$name.wav"
    done
    This should work fine. I haven't had to convert mp3s in a long time, but it looks much like the script that I used (as far as I can remember it). The end result is that "filename.mp3" is converted into "filename.wav", which is then converted into "filename.ogg".

    Also, if all of your files are named in a consistent manner (as in "Artist - Title.mp3&quot, then I have something that will ease the transition to ogg: a script that will auto matically fill in the ogg "headers" with info that it finds in the filename. By default, it looks for "Artist - Title.mp3", but this is easily overrided. You can get it from here. Then you won't need the MP3::Info thing that ralinx is talking about to preserve your ID3 tags in the oggs.

  8. #8

    Re:arrgg!! mp3 to ogg script is not going well...

    hmm .. maybe a little OT, but if i convert my mp3s to oggs wouldnt i loose quality ?

  9. #9
    Guest

    Re:arrgg!! mp3 to ogg script is not going well...

    [quote author=ch-b link=board=9;threadid=4424;start=0#44081 date=1028192425]
    hmm .. maybe a little OT, but if i convert my mp3s to oggs wouldnt i loose quality ?
    [/quote]

    technically, yes
    i converted all of my mp3s to ogg using -q5 for quality and i don't notice any difference whatsoever, except that all the files are smaller than the original mp3s
    it helped me save 3.2 gigs in total

  10. #10

    Re:arrgg!! mp3 to ogg script is not going well...

    [quote author=Ralinx link=board=9;threadid=4424;start=0#44082 date=1028194209]

    technically, yes
    i converted all of my mp3s to ogg using -q5 for quality and i don't notice any difference whatsoever, except that all the files are smaller than the original mp3s
    it helped me save 3.2 gigs in total
    [/quote]

    thx - if ill get the ogg packages to compile ill conver them ..

Similar Threads

  1. backup script
    By berto in forum Linux - General Topics
    Replies: 12
    Last Post: 12-29-2009, 05:17 PM
  2. SSH and bash script
    By vwgtiturbo in forum Programming
    Replies: 7
    Last Post: 12-25-2008, 05:40 AM
  3. script
    By try in forum Linux - General Topics
    Replies: 0
    Last Post: 12-15-2008, 07:43 AM
  4. Probs in a script called from another script
    By Outlaw in forum Programming
    Replies: 1
    Last Post: 03-12-2004, 02:54 PM
  5. arrgg!  I need to copy files from....
    By pbharris in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 02-01-2002, 12:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •