Skip to content

Instantly share code, notes, and snippets.

@TheZoc
Created June 25, 2015 02:51
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save TheZoc/0e983964edb3eaa73282 to your computer and use it in GitHub Desktop.
Save TheZoc/0e983964edb3eaa73282 to your computer and use it in GitHub Desktop.
Convert a MP3 file to an Apple iPhone's ringtone file (M4R), using FFMPEG.
@echo off
rem =====================================================
rem Converts a MP3 file to a M4R file using ffmpeg.
rem Usage: Drop a MP3 file at the top of this batch file.
rem =====================================================
set ffmpeg_exe="C:\ffmpeg\ffmpeg-20150619-git-bb3703a-win64-static\bin\ffmpeg.exe"
rem %~f1 = Full File Path, with drive letter
rem %~p1 = Drive Letter
rem %~p1 = Path Only
rem %~n1 = File Name
rem %~x1 = Extension (with dot)
%ffmpeg_exe% -i "%~f1" -ac 1 -ab 128000 -f mp4 -acodec libvo_aacenc -y "%~dpn1.m4r"
pause
@AaronM04
Copy link

Updated for ffmpeg version 4.0 and for Apple's duration limit of 30 seconds.

%ffmpeg_exe% -i "%~f1"  -ac 1 -b:a 128k -f mp4 -c:a aac -t 29.99 -y "~dpn1.m4r"

@Shujito
Copy link

Shujito commented Jul 9, 2019

Shouldn't line 9 be %~d1 instead of p?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment