Results 1 to 7 of 7

Thread: Automatically convert flac to mp3 and keep it in sync

  1. #1
    Join Date
    Apr 2008
    Beans
    17

    Automatically convert flac to mp3 and keep it in sync

    Hello!
    On my home server, I have a lot of files in flac. Flac is great for playing around the house, but does take up too much space on my phone and is not good for streaming from my home system to my laptop when I'm outside the house.

    Is there any possibilities to have a script running, which convert all my flac files into mp3, and whenever i add new files, it checks and convert those av well. Keeping the original folder structure?

    Thanks
    Gaute

  2. #2
    Join Date
    May 2006
    Beans
    253

    Re: Automatically convert flac to mp3 and keep it in sync

    sudo apt-get install soundconverter
    For the conversion when a flac file is in some directory, use cron.

  3. #3
    Join Date
    May 2010
    Location
    Tewkesbury uk
    Beans
    7,916
    Distro
    Ubuntu Development Release

    Re: Automatically convert flac to mp3 and keep it in sync

    Hi

    I have recently set up something similar.

    On a server i would look at ffmpeg for the flac to mp3 conversion. I believe this is possible for these two file types.

    This seems to suggest so.

    http://ffmpeg.org/ffmpeg.html#AVOptions

    You can monitor directories using incron and incrontab (inotify cron) that can run a script when a file is put,moved,deleted (etc) in a directory.

    The only downside with incron is that it is not directory recursive but there work-arounds.

    One is to use a recursive version of incron (Search the net. There are a number out there).

    Another workaround, that i use, is get incron to monitor a single directory and put symbolic links into that directory.

    Incron will pick up when the symbolic link is created passing you the link to the file or a directory to transcode.

    You can transcode in a script based on that link and delete the link when finished.

    Another smart thing you can do is change the operation (eg transcode type etc) based on the name of the link just like links into busy box do for different commands such as ls, date and chmod

    Kind regards
    Last edited by matt_symes; May 16th, 2012 at 12:08 AM.
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

  4. #4
    Join Date
    Aug 2009
    Location
    Under the stairs.
    Beans
    1,408
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Automatically convert flac to mp3 and keep it in sync

    For ffmpeg do: (test this first)

    Code:
    ffmpeg -i input.flac -ab 196k -ac 2 -ar 48000 output.mp3
    Dell Inspiron 1764 Laptop, Intel CoreTM i5 520M), 4GB Shared Dual Channel DDR3 at 1066MHz, 512MB ATI Mobility RadeonTM HD4330 Integrated Intel HD.

  5. #5
    Join Date
    Sep 2006
    Beans
    3,527

    Re: Automatically convert flac to mp3 and keep it in sync

    Take a look at MP3FS. It's in the repository. It converts FLAC to MP3 on-the-fly, adds ID3 tags, and may fit your needs perfectly. Point it at your LAME collection and it creates virtual MP3 files. When you access the files, such as moving the virtual MP3 files to a portable music player, they will be encoded to an actual MP3 file on the player. That way you can keep your FLAC and provide MP3 when requested without having to store both formats and deal with keeping everything in sync.
    Last edited by FakeOutdoorsman; May 16th, 2012 at 06:19 AM. Reason: explain mp3fs better

  6. #6
    Join Date
    Apr 2008
    Beans
    17

    Re: Automatically convert flac to mp3 and keep it in sync

    Quote Originally Posted by FakeOutdoorsman View Post
    Take a look at MP3FS. It's in the repository. It converts FLAC to MP3 on-the-fly, adds ID3 tags, and may fit your needs perfectly. Point it at your LAME collection and it creates virtual MP3 files. When you access the files, such as moving the virtual MP3 files to a portable music player, they will be encoded to an actual MP3 file on the player. That way you can keep your FLAC and provide MP3 when requested without having to store both formats and deal with keeping everything in sync.
    Thanks!
    This was more than I was hoping for! I'm going to test it tonight!

  7. #7
    Join Date
    Mar 2011
    Location
    Goshen, IN
    Beans
    395
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Automatically convert flac to mp3 and keep it in sync

    +1 for mp3fs

    Best if you set it up in your fstab so it gets created every boot automatically. Just make sure you mount the mp3fs AFTER you mount your music folders.

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
  •