Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

AaronM04 commented Jun 25, 2018

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

This comment has been minimized.

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
You can’t perform that action at this time.