mp3 to gsm for asterisk - mp3

In our application we allow user to upload audio file. currently we support .wav format and we use "sox" to convert the .wav file to gsm for asterisk. We would like to have mp3 support as well. Any recommendation on how to get this done ?
Your help is highly appreciated. Thanks you.

Surely you can still use sox to convert mp3 to gsm/sln/alaw/ulaw format files
Look at http://sox.sourceforge.net/soxformat.html for more info on formats sox support

Here is alot of info about asterisk file conversion.
http://www.voip-info.org/wiki/view/Asterisk+sound+files
And for sure you can use asterisk(if it compiled with mp3 support)
asterisk -rx "file convert filename.mp3 filename.gsm"
If you want convert using sox, you have recompile sox with libmad support. Here is script:
cd /usr/src/
wget -c "http://downloads.sourceforge.net/mad/libmad-0.15.1b.tar.gz?modtime=1076976000&big_mirror=0"
wget -c 'http://downloads.sourceforge.net/mad/libid3tag-0.15.1b.tar.gz?modtime=1076976000&big_mirror=0'
wget -c "http://sourceforge.net/projects/sox/files/sox/14.3.2/sox-14.3.2.tar.gz/download"
wget -c http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
wget -c "http://downloads.sourceforge.net/mad/madplay-0.15.2b.tar.gz?modtime=1077580800&big_mirror=0"
CPU=4
for i in libid3tag libmad madplay lame sox
do
cd /usr/src/
tar -xzf $i-*.gz
cd /usr/src/$i*
./configure;
make -j $CPU
make install
done;
echo /usr/local/lib/ >>/etc/ld.so.conf
ldconfig
sox
ln -s /usr/local/bin/sox /usr/bin/sox

I used a software called "switch" from NCH Software and work very well to GSM conversion and with Elastix PBX. The only problem is on Elastix GUI the upload that dont work on System Records, so I had to upload using SCP aka SFTP over SSH.
http://www.nch.com.au/switch/

Solution 1:-
localhost*CLI> help file convert
Usage: file convert
Convert from file_in to file_out. If an absolute path is not given, the
default Asterisk sounds directory will be used.
Example:
file convert tt-monkeys.gsm tt-monkeys.ulaw
Solution 2:- There are some online tool available which can work for you.
https://convertio.co/
It can convert your file in almost 20 formats. e.g gsm, wav, cdma,wma etc.

Related

Running two related commands in Subprocess Python

I am trying to start mjpg-streamer from a python script on the raspberry pi. The instructions for how to start it from the command line are here and consist of running
export LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w ./www"
-i "input_raspicam.so"
from /var/www/mjpg-streamer/mjpg-streamer-experimental. When I do it in the terminal, it works fine.
However, I am trying to run it using subprocess.call like this:
subprocess.call('export LD_LIBRARY_PATH=.', shell=True, cwd='/var/www/mjpg-streamer/mjpg-streamer-experimental')
subprocess.call('./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 640 -y 480 -fps 15 -vf -hf"', shell=True, cwd='/var/www/mjpg-streamer/mjpg-streamer-experimental')
And that is giving me the error:
MJPG Streamer Version: svn rev: ERROR: could not find input plugin
Perhaps you want to adjust the search path with:
# export LD_LIBRARY_PATH=/path/to/plugin/folder
dlopen: input_raspicam.so: cannot open shared object file: No such file or directory
I'm guessing it is because the first command doesn't provide the relevant link to the plugin? I'm not entirely sure of how these commands work anyway, so any insight into that would also be helpful!
I have also tried using os.system to run these commands and have received the same error.
I'm sure I'm doing something silly, so thanks in advance for your patience!

regex for files recognition for ffmpeg command

I'm trying to use ffmpeg command to create a time-lapse from a bunch of images in a folder. The images are named in the format -
folder_number;timestamp.jpg
eg,
0;1423116000.jpg
0;1423137600.jpg
I run the following command,
ffmpeg -i %*.jpg -q:v 2 output.mpeg
the video is getting formed but it is a 30seconds video with only the first image in the folder.
I only assume the regex i'm using - %*.jpg is wrong. Please help.
ps: I'm newbie to ffmpeg
I used the command
ffmpeg -f image2 -i 0;%*.jpg -q:v 2 output.mpeg
This did not work.
Renamed the files to have an underscore instead of semicolon.
Used the same command
ffmpeg -f image2 -i 0_%*.jpg -q:v 2 output.mpeg
Worked.

Can streamio-ffmpeg gem be used for metadata extraction from mp3 file?

Can we use 'streamio-ffmpeg gem' for extracting mp3 songs metadata(sample rate, duration etc) and write changed metadata back to mp3 file, if so than how to do that, please recommend some tutorials and codes ??
system("ffmpeg -i input_file -acodec mp3 -f mp3 -y output.mp3")
above command directly returns you output.mp3 file with only audio.
tested with ffmpeg version N-68500-g3ba1050

Using wget or curl with a changing name file

First of all please excuse my bad english, I'll try to get understandable.
I'm using a batch file (Windows, cmd.exe) to retrieve and silently install Adobe Flash on my computer.
The batch works well, but I have a problem when there is a major version change on Adobe servers.
Here is the command line batch:
#echo off
setlocal enableextensions
md c:\temp\flash
pushd c:\temp\flash
wget -nH --cut-dirs=5 -r --timestamping http://download.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_15_plugin.exe
wget -nH --cut-dirs=5 -r --timestamping http://download.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_15_active_x.exe
echo Closing browsers
pause
taskkill /f -im firefox.exe -im iexplore.exe
install_flash_player_15_plugin.exe -install -au 2
install_flash_player_15_active_x.exe -install -au 2
popd
setlocal disableextensions
pause
When Flash is upgraded to the next version, the filename changes from install_flash_player_15_active_x.exe
to
install_flash_player_16_active_x.exe
and the batch must be manually corrected or else it is stuck with an old version.
Is there any way to replace the version number with wildcards or some regular expression in order to have wget to retrieve the latest file when its name change ?
Or at least, is there any Windows compatible command line tool which parses the file names on a server, find the latest and passes it as a variable for wget (or cURL) ?
Thank you
You don't need Regular Expressions to get the current version of flash for IE and Firefox. Just change the URLs to
For Firefox: http://download.macromedia.com/pub/flashplayer/current/support/install_flash_player.exe
For IE: http://download.macromedia.com/pub/flashplayer/current/support/install_flash_player_ax.exe
wget -nH --cut-dirs=5 -r --timestamping http://download.macromedia.com/pub/flashplayer/current/support/install_flash_player.exe
wget -nH --cut-dirs=5 -r --timestamping http://download.macromedia.com/pub/flashplayer/current/support/install_flash_player_ax.exe

sox still doesn't support mp3 after its source is recompiled with mp3 support

I am trying to re-compile sox source with mp3 support on CentOS 5. Note sox-12.18.1-1.el5_5.1 has been installed on my CentOS machine for a while.
Following http://techblog.netwater.com/?p=4, I installed the following packages using yum.
yum install gcc-c++ libmad libmad-devel libid3tag libid3tag-devel lame lame-devel flac-devel libvorbis-devel make
./configure shows the following.
BUILD OPTIONS
Debugging build............no
Distro name ...............not specified!
Dynamic loading support....no
Pkg-config location........$(libdir)/pkgconfig
Play and rec symlinks......yes
Symlinks enabled...........yes
OPTIONAL DEVICE DRIVERS
ao (Xiph)..................no
alsa (Linux)...............no
coreaudio (Mac OS X).......no
sndio (OpenBSD)............no
oss........................yes
pulseaudio.................no
sunaudio...................no
OPTIONAL FILE FORMATS
amrnb......................no
amrwb......................no
ffmpeg.....................no
flac.......................yes
gsm........................yes (in-tree)
lpc10......................yes (in-tree)
mp3........................yes
id3tag....................yes
lame......................yes
dlopen lame...............no
mad.......................yes
dlopen mad................no
oggvorbis..................yes
sndfile....................no
wavpack....................no
OTHER OPTIONS
ladspa effects.............no
magic support..............yes
png support................no
GOMP support...............yes
But after executing "make && make install", issuing
sox test.mp3 tmp1.mp3 reverse
returns
sox: Failed reading test.mp3: Do not understand format type: mp3
What am I missing here? Thanks.
I had the same issue.
Make sure that there is no other Sox installed on the server:
yum remove sox
Next:
make uninstall
make clean
./configure
make
make install