Posts Tagged ‘ffmpeg’

RTPEngine 10: rpm compilation in Centos 7

Thursday, March 31st, 2022

This is a note without detailed examples.

Main idea: 1) update kernel, 2) add RPM Fusion repository and install ffmpeg from it.

If trying to compile RTPEngine 10 in CentOS 7 with ffmpeg installed from some other repository (e.g. nux-desktop, as I had) – you’ll get an error! (see screenshot)


Update kernel (my system had 3.10.0-957.el7.x86_64 after installation):

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)

Updated to the newest available from standard repository (3.10.0-1160.59.1.el7.x86_64):

yum --showduplicates list available kernel.x86_64

yum install kernel-3.10.0-1160.59.1.el7

reboot

[root@localhost ~]]# uname -a
Linux localhost.localdomain 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Add RPM Fusion repository as described here: https://rpmfusion.org/Configuration

I’ll duplicate instructions:

yum install dnf

dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %rhel).noarch.rpm

dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm

https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm

Then disable nux-desktop (if you previously installed ffmpeg from it) repository (‘enabled=0’ in /etc/yum.repos.d/nux-dextop.repo).

Ensure that ffmpeg and ffmpeg-devel now are available from just added RPM Fusion repository and install them (you’ll see repo name in the yum output, not shown here):

yum --showduplicates list available ffmpeg
yum check-update 
yum install ffmpeg ffmpeg-devel

Then create build directory structure (use rpmbuild tool).

Download version 10 ZIP archive from RTPEngine git, somewhere from here https://github.com/sipwise/rtpengine/tree/mr10.4 . Unzip it.

Put rtpengine/el/rtpengine.spec to rpmbuild/SPECS/

Then archive again into tar.gz format with such name (according to settings in .spec file!):

tar czvf ngcp-rtpengine-10.4.0.0+0~mr10.4.0.0.tar.gz rtpengine-mr10.Y.Z/

Put ngcp-rtpengine-10.4.0.0+0~mr10.4.0.0.tar.gz to rpmbuild/SOURCES/

Fire!

rpmbuild -ta rpmbuild/SOURCES/ngcp-rtpengine-10.4.0.0+0~mr10.4.0.0.tar.gz

Ready rpms will be under rpmbuild/RPMS/ .

Install them in this sequence: ngcp-rtpengine-dkms, ngcp-rtpengine, ngcp-rtpengine-debuginfo, ngcp-rtpengine-kernel, ngcp-rtpengine-recording .

sox, ffmpeg: mp3 to wav, gsm to wav

Monday, July 6th, 2015

m4a to wav:

ffmpeg -i audiofile.m4a audiofile.wav

MP3 to WAV:
user@pc:~$ sox -t mp3 fromfile.mp3 -t wav -r 8k tofile.wav channels 1
user@pc:~/Downloads$ file tofile.wav
tofile.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz

or using mpg321:

mpg321 -w output.wav input.mp3

GSM to WAV:
lexus@lexus:~$ sox beep2.gsm -r 8000 --encoding=signed-integer beep2.wav channels 2
lexus@lexus:~$ file beep2.wav
beep2.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 8000 Hz

OGG to WAV:
lexus@lexus:~$ ffmpeg -i in_file.ogg out_file.wav

Change WAV file bitrate from 44100 to 8000:
lexus@lexus:~$ file file44100.wav
file44100.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz
lexus@lexus:~$ sox file44100.wav -r 8000 file8000.wav
sox WARN rate: rate clipped 12 samples; decrease volume?
sox WARN dither: dither clipped 8 samples; decrease volume?

For newer versions of sox, working example:

stereo to mono:
sox stereo.wav mono.wav channels 1

44100 t0 8000:
sox big.wav small.wav rate 8000