Omxplayer cuts off roughly the last second of sound
Asked Answered
G

1

6

I am using Omxplayer to play a sound file stored as .MP3

The issue I am facing is that on sound files with duration > 1 second, but < 10 appear to have the end (roughly a second) of the file cut off abruptly as if the track had finished.

I am unsure what could be causing this issue as Omxplayer throws no errors and just cuts out to its usual "Have a nice day"

This is on Raspbian on Pi.

Garris answered 10/2, 2015 at 14:10 Comment(1)
I have the same issue .. I worked around it by using mplayer: /usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols <file | stream>Overdraw
A
0

Workaround I ended up using was to convert my .mp3 files to .wav, and that stopped them from being cut off. The conversion was easy enough, and it might help down the line since .wav seems to be more acceptable for a variety of tools, e.g. aplay.

I looped through each of them and used the tool lame to convert

sudo apt-get install lame
lame --decode /path/to/file.mp3 /new/path/to/file.wav

Since I happened to be having this problem in Node, I'll share that full solution to convert all .mp3 files in a directory to .wav in a loop. This assumes you have a folder full of only mp3 files, and doesn't check to enforce that:

const fs = require("fs");
const { exec } = require("child_process");

const files = fs.readdirSync("./audio_mp3/");

files.forEach((file) => {
  let newFile = file.replace('.mp3', '.wav')
  exec(`lame --decode ./audio_mp3/${file} ./audio_wav/${newFile}`);
  console.log(`Created ${newFile} in folder ./audio_wav/`);
})
Aflame answered 29/5, 2020 at 5:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.