0

On my Raspberry Pi 3 I got omxplayer which I am using to run mp3 file:

omxplayer -o alsa /home/voice/7.mp3

With -i option I get this output:

Input #0, mp3, from '/home/voice/7.mp3':
  Metadata:
    Software        : Lavf55.19.100
  Duration: 00:00:01.57, start: 0.025057, bitrate: 130 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : LAME3.99r
have a nice day ;)

Unfortunately executing first command takes about 9 seconds, while my mp3 file is only 2 seconds long. What can I do to get this command running for only 2 seconds too?

0

You could try to run omxplayer from a ramdisk:

sudo -s

mkfs -q /dev/ram15 5120
mkdir -p /ramdisk
mount /dev/ram14 /ramdisk
cp /usr/bin/omxplayer /ramdisk
cp /usr/bin/omxplayer.bin /ramdisk
nice -n -19 /ramdisk/omxplayer -o alsa /home/voice/7.mp3

It might help in loading time. However, it might not. If it does improve loading time, then you could make a script or service file that creates the ramdisk with each boot.

However, it's possible that aplay will load faster. So, you may want to transcode the mp3 as wav with ffmpeg on a different machine... since ffmpeg can be difficult to install on a Raspberry Pi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.