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

Thread: useful tips to batch convert more unusual audio formats

  1. #1
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,142
    Distro
    Ubuntu 16.04 Xenial Xerus

    useful tips to batch convert more unusual audio formats

    for reasons which i do not fully understand i am fascinated by all the different lossless formats available


    so here a small collection of batch conversions scripts which can be used in Ubuntu and all Linux systems

    the prerequisite is to have ffmpeg installed and of course the codecs of the different formats mp3HD OptimFROG ape mp4als shorten bonk are attached


    Here are "from and to" conversions scripts for shorten alac mp3hd mp4als flac ape ofr bonk




    i hope this is of use to others too or maybe i am just mad



    feel free to add more to this little bank



    ALL YOU NEED to do is cd to a folder of files and enter the line of code as in for example the first one go to a folder of wav files which will be turned into shn files THE LATEST VERSION of qmmp plays shorten now as does deadbeefand xmms



    wav to shorten



    Code:
    for f in *.wav; do shorten "$f" "${f%.wav}.shn"; done

    if you want to delete the original file add
    Code:
    && rm "$f"

    so wav to shorten becomes

    Code:
    for f in *.wav; do shorten "$f" "${f%.wav}.shn" && rm "$f"  ; done



    shorten to wav

    Code:
    for f in *.shn; do ffmpeg -i "$f" "${f%.shn}.wav"; done
    wav to mp3HD

    Code:
    for f in *.wav; do mp3hdEncoder -br 320000   -if "$f" -of "${f%.wav}.mp3"; done

    When using mp3hdEncoder or mp3hdEncoder.exe under wine make sure you have accepted the terms and conditions first IT WILL SIMPLY not work otherwiseFor mp3hdEncoder enter mp3hdEncoder in the command line and follow instructions for .exe right click and do same


    mp3HD to wav

    Code:
    for f in *.mp3; do mp3hdDecoder   -if "$f" -of "${f%.mp3}.wav"; done
    wav to alac apple lossless

    Code:
    for f in *.wav; do ffmpeg -i  "$f" -acodec alac "${f%.wav}.m4a"; done
    alac to wav


    Code:
    for f in *.m4a; do ffmpeg -i "$f" "${f%.m4a}.wav"; done
    alac to flac

    Code:
    for f in *.m4a; do ffmpeg -i "$f" "${f%.m4a}.flac"; done

    flac to alac

    Code:
    for f in *.flac; do ffmpeg -i "$f" -acodec alac "${f%.flac}.m4a"; done

    wav to mp4als

    Code:
    for f in *.wav; do mp4alsRM22rev2  "$f"  "${f%.wav}.mp4"; done
    and to decompress

    Code:
       for f in *.mp4; do mp4alsRM22rev2 -x -v "$f"  "${f%.mp4}.wav"; done


    wav to bonk

    Code:
    for f in *.wav; do bonk encode -l "$f"  "${f%.wav}.bonk"; done

    wav to ofr OptimFROG

    Code:
    for f in *.wav; do ofr --encode  "$f"  "${f%.wav}.ofr"; done
    wav to ape


    Code:
    for f in *.wav; do mac "$f" "${f%.wav}.ape" -c5000 ; done
    ape to flac

    Code:
    for f in *.ape; do ffmpeg -i "$f" "${f%.ape}.flac"; done
    ape to alac

    Code:
    for f in *.ape; do ffmpeg -i "$f" -acodec alac "${f%.ape}.m4a"; done
    ape to shorten


    Code:
    for f in *.ape; do mac  "$f" "${f%.ape}.wav" -d ; done && for f in *.wav; do shorten "$f" "${f%.wav}.shn" && rm "$f"  ; done && rm *.ape

    shorten to alac

    Code:
    for f in *.shn; do ffmpeg -i "$f" -acodec alac "${f%.shorten}.m4a"; done



    wavpack to flac

    Code:
    for f in *.wv; do ffmpeg -i "$f"  "${f%.wv}.flac"; done

    To mp3 320kbps (lossy) (here from flac but simply replace word flac by name of codec you start from)


    Code:
    for f in *.flac; do ffmpeg -i "$f" -ab 320k "${f%.flac}.mp3"; done



    ALSO if you want to rip a disc to any of those formats You may want to use Rubyripper since it allows for external encoding
    Attached Files Attached Files
    Last edited by shantiq; March 30th, 2011 at 10:48 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community
    Playing with Slackware too now ...
    ShanArt

  2. #2
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,142
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: useful tips to batch convert more unusual audio formats

    for some of the more usual formats


    shntool is also very handy

    Code:
    format    ext     input    output  description
     ------    ---     -----    ------  -----------
        wav   .wav   shntool   shntool  RIFF WAVE file format
       aiff  .aiff       sox       sox  Audio Interchange File Format
        shn   .shn   shorten   shorten  Shorten low complexity waveform coder
       flac  .flac      flac      flac  Free Lossless Audio Codec
        ape   .ape       mac       mac  Monkey's Audio Compressor
        ofr   .ofr       ofr       ofr  OptimFROG Lossless WAVE Audio Coder
       lpac      -      lpac         -  Lossless Predictive Audio Compression
         wv    .wv  wvunpack   wavpack  WavPack Hybrid Lossless Audio Compression
       alac      -      alac         -  Apple Lossless Audio Codec
         la      -        la         -  Lossless Audio Compresser
        tta   .tta    ttaenc    ttaenc  TTA Lossless Audio Codec
        als   .als    mp4als    mp4als  MPEG-4 Audio Lossless Coding
        tak   .tak      takc      takc  (T)om's lossless (A)udio (K)ompressor
       bonk  .bonk      bonk      bonk  Bonk lossy/lossless audio compressor
        kxs      -     kexis         -  Kexis lossless WAV file compressor
        mkw   .mkw    mkwcon    mkwcon  MKW Audio Compression format
       cust      -         -   shntool  Custom output format module
       term      -         -   shntool  Sends output to the terminal
       null      -         -   shntool  Sends output to /dev/null
    for batch convert use this

    Code:
    shnconv -o shn * flac
    would convert all your files in a folder from flac to shn -o is for output change formats to your needs (in my experience they do not all work but the main ones do)
    Last edited by shantiq; November 1st, 2010 at 10:34 AM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community
    Playing with Slackware too now ...
    ShanArt

  3. #3
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,142
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: useful tips to batch convert more unusual audio formats

    ok and if you wanted to batch convert to Tak

    more info





    you can do that too by placing Takc.exe (attached) in the folder where the wav files are and making it executable


    then enter (omit red code if you want to keep wavs)

    Code:
    for f in *.wav; do wine takc -e -p4  "$f" "${f%.wav}.tak" && rm "$f";  done
    And to convert to tak from flac (and remove flacs)


    Code:
    flac -d *.flac && rm *.flac && for f in *.wav; do wine takc -e -p4  "$f" "${f%.wav}.tak" && rm "$f";  done

    will play in foobar or winamp under wine
    Attached Files Attached Files
    Last edited by shantiq; January 13th, 2011 at 10:34 AM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community
    Playing with Slackware too now ...
    ShanArt

  4. #4
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,142
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: useful tips to batch convert more unusual audio formats

    also useful if you download tracks in 24-bit and 32-bit in sample rate of say 96000Hz and want to be able to turn into burnable wavs


    you can use sox in this way



    from flac

    Code:
    for f in *.flac; do sox  "$f" -b 16 -r 44100  "${f%.flac}.wav"; done

    from wavpack

    Code:
    for f in *.wv; do sox  "$f"  -b 16 -r 44100 "${f%.wv}.wav"; done

    all info on this page attached as a Pdf
    Last edited by shantiq; January 13th, 2011 at 11:19 AM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community
    Playing with Slackware too now ...
    ShanArt

  5. #5
    Join Date
    May 2008
    Beans
    6

    Re: useful tips to batch convert more unusual audio formats

    Perfect. Just what I needed. Thank you for posting.

  6. #6
    Join Date
    Apr 2009
    Beans
    130

    Re: useful tips to batch convert more unusual audio formats

    Outstanding post. Thanks.

  7. #7
    Join Date
    Dec 2006
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: useful tips to batch convert more unusual audio formats

    Agreed, great post!

    Another options for many formats is to use the GNOME application SoundConverter.

  8. #8
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,142
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: useful tips to batch convert more unusual audio formats

    Quote Originally Posted by Repabil View Post
    Agreed, great post!

    Another options for many formats is to use the GNOME application SoundConverter.


    yes repabil soundconverter best of the GUI converters but one might love to see see those numbers spin when at the command-line



    one more conversion is from flac to aac/m4a
    but keeping the tags this one was givem me by mc4man



    Code:
    #!/bin/bash
    for f in *.flac
    do
    OUTF=`echo "$f" | sed s/\.flac$/.m4a/g`
    
    ARTIST=`metaflac "$f" --show-tag=ARTIST | sed s/.*=//g`
    TITLE=`metaflac "$f" --show-tag=TITLE | sed s/.*=//g`
    ALBUM=`metaflac "$f" --show-tag=ALBUM | sed s/.*=//g`
    GENRE=`metaflac "$f" --show-tag=GENRE | sed s/.*=//g`
    TRACKTOTAL=`metaflac "$f" --show-tag=TRACKTOTAL | sed s/.*=//g`
    DATE=`metaflac "$f" --show-tag=DATE | sed s/.*=//g`
    TRACKNUMBER=`metaflac "$f" --show-tag=TRACKNUMBER | sed s/.*=//g`
    
    flac -c -d "$f" - | neroAacEnc -if -  -cbr 320000 -of  "$OUTF"
    neroAacTag "$OUTF"  -meta:artist="$ARTIST" -meta:title="$TITLE" -meta:album="$ALBUM" -meta:genre="$GENRE" -meta:year="$DATE" -meta:track="$TRACKNUMBER" -meta:totaltracks="$TRACKTOTAL"
    done
    mkdir "$ALBUM" && mv *.m4a "$ALBUM"


    ps : you can bump up
    kbps to 516 with neroAacEnc change 320000 to 516000
    Last edited by shantiq; May 7th, 2011 at 09:16 AM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community
    Playing with Slackware too now ...
    ShanArt

  9. #9
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,142
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: useful tips to batch convert more unusual audio formats

    there is yet another codec which can be obtained through ffmpeg
    it is used as the sound file in high quality DOLBY videos


    ac3 is lossy but goes up to 640kbps giving you a small file with high kbps




    maybe try it on some flac files or wav


    Code:
    for f in *.flac; do ffmpeg -i "$f" -ab 640k "${f%.flac}.ac3"; done

    Code:
    for f in *.wav; do ffmpeg -i "$f" -ab 640k "${f%.flac}.ac3"; done
    it has to be certain settings for kbps which are

    640,576,512,448,384,320,256,224,192,160,128,112,96 ,80,64,56,48,32



    ac3 plays in all recent players
    Last edited by shantiq; March 14th, 2011 at 10:16 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community
    Playing with Slackware too now ...
    ShanArt

  10. #10
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,142
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: useful tips to batch convert more unusual audio formats

    and if the command line is not really your thing


    soundKonverter in your synaptic or
    Code:
    sudo apt-get install soundkonverter

    now will convert any lossless format to any other provided you have them installed


    see image/ set output to source directory to know where to find your files / set quality to lossless


    Last edited by shantiq; June 4th, 2011 at 11:29 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community
    Playing with Slackware too now ...
    ShanArt

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •