Back to Randomise USR 0 home

FFmpeg

Convert au to mp3

    ./ffmpeg -i source.m4a output.mp3

Reducing the file size - Addional MP3 encode info

For a file of 6.9 Mbyte

The following command

    ./ffmpeg -i sourceSound.mp3 -codec:a libmp3lame -qscale:a 8  output.mp3

will reduce it to 3.9 Mbyte. Different settings yield the following file sizes

setting size
original 6.9 Mb
-qscale:a 0 5 Mb
-qscale:a 1 4.4 Mb
-qscale:a 2 3.9 Mb
-qscale:a 3 3.6 Mb
-qscale:a 4 3.2 Mb
-qscale:a 5 2.7 Mb
-qscale:a 6 2.3 Mb
-qscale:a 7 2 Mb
-qscale:a 8 1.8 Mb This one sounds good enough for a casual game
-qscale:a 9 1.5 Mb Noticeable degradation for high frequencies

Reduce an image size

FFmpeg can be used to scale PNG.

As an example, the following command will generate a 512x512

    ./ffmpeg -i icon.png -vf scale=512:512 icon512.png

If you want to cough up all the different icon sizes that Xcode asks for iOS create a script file with the content below. Provide and input file named icon.png at 1024x1024 resolution

    ./ffmpeg -i icon.png -vf scale=512:512 icon512.png
    ./ffmpeg -i icon.png -vf scale=40:40 icon40_iPhone_Notification_iOS_7_10_2x_40px.png
    ./ffmpeg -i icon.png -vf scale=60:60 icon60_iPhone_Notification_iOS_7_10_3x_60px.png
    ./ffmpeg -i icon.png -vf scale=58:58 icon58_iPhone_Spotlight_iOS_5-6_2x_58px.png
    ./ffmpeg -i icon.png -vf scale=87:87 icon87_iPhone_Spotlight_iOS_5-6_3x_87px.png
    ./ffmpeg -i icon.png -vf scale=80:80 icon80_iPhone_Spotlight_iOS_7-10_2x_80px.png
    ./ffmpeg -i icon.png -vf scale=120:120 icon120_iPhone_Spotlight_iOS_7-10_3x_120px.png
    ./ffmpeg -i icon.png -vf scale=120:120 icon120_iPhone_APP_iOS_7-10_2x_120px.png
    ./ffmpeg -i icon.png -vf scale=180:180 icon180_iPhone_APP_iOS_7-10_3x_180px.png
    ./ffmpeg -i icon.png -vf scale=20:20 icon_iPad_notifications_iOS_7-10_2x_20px.png
    ./ffmpeg -i icon.png -vf scale=40:40 icon_iPad_notifications_iOS_7-10_3x_40px.png
    ./ffmpeg -i icon.png -vf scale=29:29 icon_iPad_settings_iOS_5-10_1x_29px.png
    ./ffmpeg -i icon.png -vf scale=58:58 icon_iPad_settings_iOS_5-10_2x_58px.png
    ./ffmpeg -i icon.png -vf scale=40:40 icon_iPad_spotlight_iOS_7-10_1x_40px.png
    ./ffmpeg -i icon.png -vf scale=80:80 icon_iPad_spotlight_iOS_7-10_2x_80px.png
    ./ffmpeg -i icon.png -vf scale=76:76 icon_iPad_APP_iOS_7-10_1x_76px.png
    ./ffmpeg -i icon.png -vf scale=152:152 icon_iPad_APP_iOS_7-10_2x_152px.png
    ./ffmpeg -i icon.png -vf scale=167:167 icon_iPadPro_APP_iOS_9-10_2x_167px.png