This is a text-only version of the following page on https://raymii.org:
---
Title       : 	EasyConverter
Author      : 	Remy van Elst
Date        : 	23-12-2009
URL         : 	https://raymii.org/s/software/Easyconverter.html
Format      : 	Markdown/HTML
---



### Introduction

This is a Zentiy dialog script wrapper around ffmpeg. It was written for my
father who wanted to convert FLAC and OGG files to MP3 for his media player.

<p class="ad"> <b>Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:</b><br><br> <a href="https://leafnode.nl">I'm developing an open source monitoring app called  Leaf Node Monitoring, for windows, linux & android. Go check it out!</a><br><br> <a href="https://github.com/sponsors/RaymiiOrg/">Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.</a><br><br> <a href="https://www.digitalocean.com/?refcode=7435ae6b8212">You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days. </a><br><br> </p>


![img][2]

![img][3]

![img][4]

![img][5]

Features in v4:

  * Extension select before folder.
  * Filter on extension
  * Check if files exist in folder.
  * Added .flv to input format (Youtube ripped videos)
  * Added .aac to input/output format
  * Quality selector for ffmpeg
  * Removed folder check.
  * Added nautilus open when converting finished. 

Note that you'll need zenity and ffmpeg:

    
    
    sudo apt-get install zenity ffmpeg 
    

### Script

    
    
    #!/bin/bash
    
    ####################################
    ##   Script made by Raymii.org    ##
    ####################################
    
    # V0.4 new features:
    # Extension select before folder.
    # Filter on extension
    # Check if files exist in folder.
    # Added .flv to input format
    # Added .aac to input/output format
    # Quality selector for ffmpeg
    # removed folder check.
    # added nautilus open when converting finished.
    # fixed the ogg big files problem, thanks http://identi.ca/habtool and http://identi.ca/lesp
    
    
    padself=`pwd`/`basename $0`
    
    function catch_errors() {
       zenity --question --text="There is something wrong. Do you want to quit or restart the app?" --cancel-label="Quit" --ok-label="Restart";
       [ "$?" = "0" ] &&&& ( bash -c $padself && );
       exit 0;
    }
    
    function func_error2() {
        echo `date +%h:%m:%s`
    }
    
    trap catch_errors ERR;
    
    mapvraag=0
    titel="EasyConverter v0.4g"
    KBs=128;
    FGOED=1;
    opts="";
    
    zenity --info --text="Hi, I'm **$titel** nI will help you with converting files to another format. n nIn the next window, please select the format of the files. After that please select the folder which has the audio files." --title="$titel"
    
    vanform=$(zenity  --list --title="Select a file extension" --height=270 --text "Which filetype do you want to convert?" --radiolist  --column "Choose" --column "Original Format" TRUE flac FALSE ogg FALSE wav FALSE mp3 FALSE aac FALSE flv);
    
    mapvraag=$(zenity --file-selection --directory --title="Please select a folder with $vanform files." --file-filter="*.$vanform" );
    
    pushd "$mapvraag"
    for f in ./*.$vanform; do
            test -f "$f" || continue
            echo "$f bestaat, mooi zo.";
            FGOED=2;
        done    
    popd
    
    if [ $FGOED == 1 ]; then
        zenity --error --text="Oops, the filetype you selected is not found in the folder you selected. nPlease try again." --title="$titel";
        return 1;
    fi
    
    formaat=$(zenity  --list --height=270 --text "And what should they become?" --radiolist  --column "Choose" --column "Converted Format" TRUE mp3 FALSE ogg FALSE wav FALSE flac FALSE aac);
    if [ $vanform = $formaat ]; then
        zenity --error --text="You choose the same input and output format nI can't convert the files if you do that. nLets restart." --title="$titel"
        return 1;
        exit
    fi
    
    if [ $formaat == "ogg" ]; then
        opts="-acodec libvorbis";
    fi
    
    KBs=$(zenity  --list --height=380 --text "What output quality you want me to tell ffmpeg?n*64k*: nSmall filesnLow quality n*320k*: nBig filesnHigh quality." --radiolist  --column "Choose" --column "kbps" TRUE 64 FALSE 96 FALSE 128 FALSE 192 FALSE 256 FALSE 320);
    
    finalcheck=$(zenity --question --cancel-label="Don't" --ok-label="Lets Rock Baby!" --text="We're going to convert all files in: **$mapvraag** to ***$formaat*** at ***$KBs** kb/s*. Last check, Do or Don't?" --title="$titel")
    
    trap func_error2 ERR;
    
    pushd "$mapvraag"
    for i in *.$vanform; do
            mkdir -p "$mapvraag/converted/$formaat/"
            ffmpeg -y -i "$i" -ab $KBs"k" $opts "$mapvraag/converted/$formaat/$i.$formaat" 2>&&1 | zenity --progress --text="Converting: **$i** from **$vanform** to **$formaat** at **$KBs** kb/s" --title="$titel" --auto-close --pulsate
            echo $i gedaan
    
    done
    
    zenity --question --cancel-label="Nope, just quit." --ok-label="Yes, open it." --text="Done! nI've saved the converted files in this folder: **$mapvraag/converted/$formaat**. n nWould you like me to try and open Nautilus in the output folder? n n nThis little script is made by: **Raymii.org**." --title="$titel";
    [ "$?" = "0" ] &&&& nautilus --no-desktop "./converted/$formaat";
    popd
    echo Done
    

[Thanks to Andrew from webupd8 for posting it on http://webupd8.org][6]

   [1]: https://www.digitalocean.com/?refcode=7435ae6b8212
   [2]: https://raymii.org/s/inc/img/easyconverter/easyconv1.png
   [3]: https://raymii.org/s/inc/img/easyconverter/easyconv2.png
   [4]: https://raymii.org/s/inc/img/easyconverter/easyconv3.png
   [5]: https://raymii.org/s/inc/img/easyconverter/easyconv4.png
   [6]: http://www.webupd8.org/2010/03/zenity-ffmpeg-bash-script-to-convert.html

---

License:
All the text on this website is free as in freedom unless stated otherwise. 
This means you can use it in any way you want, you can copy it, change it 
the way you like and republish it, as long as you release the (modified) 
content under the same license to give others the same freedoms you've got 
and place my name and a link to this site with the article as source.

This site uses Google Analytics for statistics and Google Adwords for 
advertisements. You are tracked and Google knows everything about you. 
Use an adblocker like ublock-origin if you don't want it.

All the code on this website is licensed under the GNU GPL v3 license 
unless already licensed under a license which does not allows this form 
of licensing or if another license is stated on that page / in that software:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Just to be clear, the information on this website is for meant for educational 
purposes and you use it at your own risk. I do not take responsibility if you 
screw something up. Use common sense, do not 'rm -rf /' as root for example. 
If you have any questions then do not hesitate to contact me.

See https://raymii.org/s/static/About.html for details.