Results 1 to 7 of 7

Thread: conversion of audio files to new folder

  1. #1
    Join Date
    Jun 2010
    Beans
    119
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    conversion of audio files to new folder

    Code:
    for f in *.ogg; do ffmpeg -i "$f" -ab 128k "${f%.ogg}.mp3"; done
    I need to convert files to a new path. I found the above command but I don't where to place path to destination folder.
    In need to do it in terminal, that's why I don't want to use GUI program.

  2. #2
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!

    Re: conversion of audio files to new folder

    It might be easier to convert with avconv then move the mp3 file you made.
    Code:
    avconv -i *.ogg -acodec libmp3lame -aq 5 output.mp3 && mv output.mp3 /full/path/to/output.mp3
    If you have many files I presume you can edit the command to do what your original command did with them all, but I admit my bash skills are not really up to telling you how to do that.
    DISTRO: Xubuntu 16.04-64bit --- Code-tags --- Boot-Repair --- Grub2 wiki & Grub2 Basics --- RootSudo --- Wireless-Info --- SolvedThreads

  3. #3
    Join Date
    Dec 2006
    Beans
    7,312

    Re: conversion of audio files to new folder

    It is a little aside to your query but perhaps you could experiment a little with -q:a x settings as described here...
    You think that's air you're breathing now?

  4. #4
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!

    Re: conversion of audio files to new folder

    A second thought on this.

    If you run the ffmpeg or avconv command from the destination folder and use the full pathway to the files you are converting the output files will be in the folder where you ran the command, so this should kill the two birds with the one command.
    DISTRO: Xubuntu 16.04-64bit --- Code-tags --- Boot-Repair --- Grub2 wiki & Grub2 Basics --- RootSudo --- Wireless-Info --- SolvedThreads

  5. #5
    Join Date
    Jun 2007
    Beans
    12,735

    Re: conversion of audio files to new folder

    Why are you doing lossy -> lossy conversion?
    I was reading a book about Genghis Khan when I made my account and I empathized with aspects of his life. It doesn't mean I want to kill everyone. You're taking the interweb too seriously. I'm trying to help you, seriously. Use the eye test.

  6. #6
    Join Date
    Jun 2007
    Beans
    16,213

    Re: conversion of audio files to new folder

    Only in regards to question -
    just put the path in front of "${f%.ogg}.mp3"

    You can either full path to folder desired or use
    ./ # target folder is inside current folder
    ../ # target folder is 1 directory up
    ../../ # target folder is 2 directories up

    ex. - files to convert are in ~/Music, want to send to folder in Music named mp3
    At the ~/Music$ prompt (red is your username
    for f in *.ogg; do ffmpeg -i "$f" -ab 128k /home/doug/Music/mp3/"${f%.ogg}.mp3"; done
    or
    for f in *.ogg; do ffmpeg -i "$f" -ab 128k ./mp3/"${f%.ogg}.mp3"; done

    ex. files are in ~/Music, want to send to folder in home named mp3
    At the ~/Music$ prompt
    for f in *.ogg; do ffmpeg -i "$f" -ab 128k ../mp3/"${f%.ogg}.mp3"; done

    ect., ect., easy to figure out, just make sure your target folder exists
    Last edited by mc4man; December 16th, 2013 at 06:06 PM.

  7. #7
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!

    Re: conversion of audio files to new folder

    Why are you doing lossy -> lossy conversion?
    Probably for the same reason I do occasionally; I have an mp3 player that will not play .ogg files, so no other option.
    DISTRO: Xubuntu 16.04-64bit --- Code-tags --- Boot-Repair --- Grub2 wiki & Grub2 Basics --- RootSudo --- Wireless-Info --- SolvedThreads

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
  •