Mpg123 don't seem to work

Hi I try to playing a mp3 file with the command line tool mpg123 but that don’t playing the file. I get just some information about my mp3 and it close (return to Terminal command).

Doesn’t work here either. I do get informative error output though:

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
        version 1.28.0; written and copyright by Michael Hipp and others
        free software (LGPL) without any warranty but with best wishes
[src/libout123/libout123.c:out123_open():485] error: Found no driver out of [] working with device <default>.
main: [src/mpg123.c:check_fatal_output():332] error: out123 error 3: failure loading driver module

Doing media_client play MyFile.mp3 works.

1 Like


Thanks you tool work.

I have find this code that use “mpg123” as decoder and “ao” as playback if I understand.

#include <ao/ao.h>
#include <mpg123.h>

#define BITS 8

int main(int argc, char *argv[])
    mpg123_handle *mh;
    unsigned char *buffer;
    size_t buffer_size;
    size_t done;
    int err;
	int driver;
    ao_device *dev;

    ao_sample_format format;
    int channels, encoding;
    long rate;

    if(argc < 2)

    /* initializations */
    driver = ao_default_driver_id();
    mh = mpg123_new(NULL, &err);
    buffer_size = mpg123_outblock(mh);
    buffer = (unsigned char*) malloc(buffer_size * sizeof(unsigned char));

    /* open the file and get the decoding format */
    mpg123_open(mh, argv[1]);
    mpg123_getformat(mh, &rate, &channels, &encoding);

    /* set the output format and open the output device */
    format.bits = mpg123_encsize(encoding) * BITS;
    format.rate = rate;
    format.channels = channels;
    format.byte_format = AO_FMT_NATIVE;
    format.matrix = 0;
    dev = ao_open_live(driver, &format, NULL);

    /* decode and play */
    while (mpg123_read(mh, buffer, buffer_size, &done) == MPG123_OK)
        ao_play(dev, buffer, done);

    /* clean up */

    return 0;

gcc main.c -o play -lmpg123 -lao

That need mpg123 devel and lao devel. The final app work at the same:
play mp3file.mp3