In order to get round this problem, the only option may be to build from source
. That solved any issues for me. I uninstalled any of the ffmpeg
packages currently on the system that I had tried to use, and used this excellent Ubuntu compilation guide. This was the only way I could encode to proprietary formats such as mp4 and mp3.
In addition, the following script, which I have modified (credit to the original creator), can again be further altered and used to convert mp4 to 3gp
or mp4 to mp3
(to extract the audio), or anything whatsoever. It also preserves the original name of the file in the newly converted file: It is however important to fill in the options correctly.
You can use different options for 3gp; for example,you may want a different resolution than qcif
(176x144), but I found these settings initially worked for me with my compiled
version of ffmpeg
. (The conversion may take a while, depending on how powerful your CPU is, as converting it to 3gp reduces the file size quite a lot: 314mb to 13 mb for one of my conversions!)
Save this script below to a new document and make it executable (chmod +x
), place it in the desired folder and execute it; or use the terminal to select the folder the script is in and the target folder containing the files; e.g. ~/Scripts/script ~/Downloads
#!/bin/bash
for f in *.mp4
do
name="${f/.mp4/.3gp}"
ffmpeg -i "$f" -vcodec h263 -s qcif -r 15 -b 100k -acodec libfaac -ac 1 -ar 32000 -ab 64k -f 3gp "$name"
done