Can't rip mp3 with kio slave or K3b - libsndfile error

I am unable to rip from CD to .mp3 using pretty much any tool.

Dolphin / Konqueror auidiocd:// KIO slave shows the mp3 folder, but when you move the tracks you get:

Could not read some_song.mp3: encoding failed
WARNING: libsndfile may ignore -r and perform fseek’s on the input.
Compile without libsndfile if this is a problem.

I’m running 11.3 (KDE 4.4.4) with K3B 2 from Packman (with the k3b 2 codec package) and K3B fails as does the KIO slave method above.

Lame version is:

Restricted multimedia formats packages are installed from Restricted formats/11.3 - openSUSE Community Wiki

Alsa works great otherwise, I have no sound issue, etc. - just can’t rip anything to mp3

Seems like I’m not the only one who has had this problem, there are a few posts here on the Suse Forum, and others elsewhere, but the resolution seems to be nebulous at best. Sometimes lame 3.98 from packman works for some guys, other times not, etc.

Any suggestions on how I might get this working?

Lews Therin


Unable to rip an audio cd into mp3’s using 11.2 - - ArchiveOrange

I would ask that you do a few things. One is to run the mmcheck bash script file and let us know of anything it might be looking for that is missing. Do keep in mind the latest revamping of Packman as more than one repository may need to be added these days, but missing files are still important to know.

MultiMedia Checker or mmcheck - Check Your openSUSE MultiMedia Setup in Just 16 Steps

Next, as an openSUSE 11.3 user, you should be able to download and install Asunder. This one file absolutely worked the best for me to rip Audio CD’s to MP3 files. Please give this application a try out.

Any one that has more than one optical drive installed needs to understand about drive naming conventions and the selection of /dev/dvd and /dev/cdrom. Here is a write up I have on this subject.

Multimedia Optical Drive Naming (ie /dev/dvd & /dev/cdrom) Howto in opneSUSE

I must say that short of an actual hard ware problem with your optical drive, or a lot of dust sucked into the drive, both of which does happen more often than you would think, one of the choices above will point you to the software problem you are having.

Thank You,

Hi there,

Thanks for the suggestions. Sadly, though that did not resolve it.

The script was pretty cool - helpful tool. However, I had the the required packages and everything looks fine.

I tried Asunder - it just hangs with no messages whatsoever to std out or error.

Thanks for the info on optical device names - I have only one otical device and it is recognized correctly by all applications. Drive is about 2 months old and works flawlessly.

This error is rather annoying - and I can see from Google results it is far from uncommon. Perhaps it will be fixed in the upcoming 11.4

Rather sad though really - ripping mp3’s used to be pretty simple - it just worked. The KDE kio slave was so easy to use. Seems like guys are having this same trouble, not just with Suse but other distros as well. Unfortunatly, I don’t see there is too much to go on here - - which is likely why it has not been resolved yet.

Lews Therin

Hi LewsTherinTelemon,

The package that works best for me is jRipper both on openSUSE11.3 and 11.4 RC1.
Info from current install is (11.4 RC1) :- (Make sure all dependencies are met!)

jRipper =

rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadIsLzma) <= 4.4.6-1
java >= 1.6


Hi Michael,

Thanks for the suggestion on Jripper - I’ll check it out.

I found the solution to this problem, and what do you know - the original error message did indeed show the problem, though that being the case I don’t see how the 64-bit version of lame in Packman works for anyone:

Original error when using K3B or audiocd://

Could not read some_song.mp3: encoding failed
WARNING: libsndfile may ignore -r and perform fseek’s on the input.
Compile without libsndfile if this is a problem.

I downloaded and compiled the latest version of lame from Sourceforge - which is the same version as the one I had from Packman - 3.98.4. The version I compiled, specifying no additional options, allows ripping of mp3 files no problem.

Running ldd on the packman binary, and the one I compiled, show that the pm one is indeed compiled with libsndfile

Callandor:~ # ldd /usr/bin/lame*
/usr/bin/lame: => (0x00007fff563ff000) => /lib64/ (0x00007fc9202d2000) => /lib64/ (0x00007fc92007b000) => /lib64/ (0x00007fc91fd1b000) => /lib64/ (0x00007fc91fb17000)
/lib64/ (0x00007fc920527000)

/usr/bin/lame-pm: => (0x00007fff9cfff000) => /usr/lib64/ (0x00007f84c6fc3000) => /lib64/ (0x00007f84c6d6e000) => /usr/lib64/ (0x00007f84c6b07000) => /lib64/ (0x00007f84c68b0000) => /lib64/ (0x00007f84c6550000) => /lib64/ (0x00007f84c634c000) => /usr/lib64/ (0x00007f84c60fc000) => /usr/lib64/ (0x00007f84c5d21000)
/lib64/ (0x00007f84c723f000) => /usr/lib64/ (0x00007f84c5b1a000) => /usr/lib64/ (0x00007f84c58ed000)

Perhaps under certain circumstances the 64-bit version from Packman might work for some people, but I don’t really see how given the above. I’d like to know if anyone has the Packman version, linked to libsndfile, actually working.

Lews Therin

Here is the output of this command under openSUSE 11.4 RC2 for comparison.

ldd /usr/bin/lame* =>  (0x00007fff533ff000) => /usr/lib64/ (0x00007f611b1e5000) => /lib64/ (0x00007f611af90000) => /usr/lib64/ (0x00007f611ad28000) => /lib64/ (0x00007f611aad1000) => /lib64/ (0x00007f611a764000) => /lib64/ (0x00007f611a560000) => /usr/lib64/ (0x00007f611a311000) => /usr/lib64/ (0x00007f6119e42000)
        /lib64/ (0x00007f611b461000) => /usr/lib64/ (0x00007f6119c3b000) => /usr/lib64/ (0x00007f6119a0e000)

Let me say three things. First off, I am very happy you were able to fix your problem. Also, no matter your best intentions, things can get corrupted on your PC due to no fault of your own which can create some odd problems. Finally, Packman has been under reorganization for some time (like many weeks) and there has been missing dependencies and invalid dependencies on their repository which has caused all sorts of additional issues. I personally would be more than willing to put this original problem off on Packman. But of course, it is hard to know for sure.

Thank You,

Now, that you mention it. Turns out I have the same problem, even on two different machines.

Luckily, I generally rip to FLAC anyway, which works great.

I had precisely the same problem. I too download the sources, compiled with no options, and the problem was solved.

or install the vlc version from the opensuse vlc repo as that works.

After doing some reading around this might be a Packman packaging problem which has been raised with them

Thank you for this - I had the same problem on 11.4 (but a working, presumably older, version on 11.3) and your solution solved all.

I too had this problem on 11.3 & 11.4.

The problem is caused by libsndfile failing with raw input, so using a build without libsnd file will indeed solve the problem.

This isn’t a solution for everyone, however, because libsndfile provides lots of extra input file options that lame cannot provide on its own. (I guess that’s why it tries to perform the seeks - to figure out the input format.)

I’ve created a patch that uses lame’s internal functions for raw input (ie with the -r option), and keeps libsndfile for everything else. It works for me.

 diff -uNr ../lame-3.98.4.orig//frontend/get_audio.c .//frontend/get_audio.c
--- ../lame-3.98.4.orig//frontend/get_audio.c	2009-01-18 15:44:28.000000000 +0000
+++ .//frontend/get_audio.c	2011-06-10 17:58:10.000000000 +0100
@@ -532,10 +532,19 @@
+static int
+internal_read_samples_pcm(FILE * musicin, int sample_buffer[2304], int samples_to_read);
+static void
+internal_CloseSndFile(sound_file_format input, FILE * musicin);
+static FILE   *
+internal_OpenSndFile(lame_global_flags * gfp, char *inPath, int *enc_delay, int *enc_padding);
 #if defined(LIBSNDFILE)
 ** Copyright (C) 1999 Albert Faber
@@ -564,6 +573,12 @@
 CloseSndFile(sound_file_format input, FILE * musicin)
     SNDFILE *gs_pSndFileIn = (SNDFILE *) musicin;
+    if( force_internal ) {
+        internal_CloseSndFile(input, musicin);
+    return;
+    }
     if (is_mpeg_file_format(input)) {
 #ifndef AMIGA_MPEGA
         if (fclose(musicin) != 0) {
@@ -596,6 +611,11 @@
     SNDFILE *gs_pSndFileIn = NULL;
     SF_INFO gs_wfInfo;
+    if( force_internal ) {
+        return internal_OpenSndFile(gfp, inPath, enc_delay, enc_padding);
+    }
     if (is_mpeg_file_format(input_format)) {
         if (-1 == lame_decode_initfile(lpszFileName, &mp3input_data)) {
@@ -856,6 +876,12 @@
     int     samples_read;
+    if( force_internal ) {
+        return internal_read_samples_pcm(musicin, sample_buffer, samples_to_read);
+    }
     samples_read = sf_read_int((SNDFILE *) musicin, sample_buffer, samples_to_read);
 #if 0
@@ -888,6 +914,28 @@
 #else /* defined(LIBSNDFILE) */
+static int
+read_samples_pcm(FILE * musicin, int sample_buffer[2304], int samples_to_read)
+    return internal_read_samples_pcm(musicin, sample_buffer, samples_to_read);
+CloseSndFile(sound_file_format input, FILE * musicin)
+    internal_CloseSndFile(input, musicin);
+FILE   *
+OpenSndFile(lame_global_flags * gfp, char *inPath, int *enc_delay, int *enc_padding)
+    return internal_OpenSndFile(gfp, inPath, enc_delay, enc_padding);
@@ -979,7 +1027,7 @@
 static int
-read_samples_pcm(FILE * musicin, int sample_buffer[2304], int samples_to_read)
+internal_read_samples_pcm(FILE * musicin, int sample_buffer[2304], int samples_to_read)
     int     samples_read;
     int     swap_byte_order;     /* byte order of input stream */
@@ -1430,8 +1478,8 @@
-CloseSndFile(sound_file_format input, FILE * musicin)
+static void
+internal_CloseSndFile(sound_file_format input, FILE * musicin)
     (void) input;
     if (fclose(musicin) != 0) {
@@ -1446,8 +1494,8 @@
-FILE   *
-OpenSndFile(lame_global_flags * gfp, char *inPath, int *enc_delay, int *enc_padding)
+static FILE   *
+internal_OpenSndFile(lame_global_flags * gfp, char *inPath, int *enc_delay, int *enc_padding)
     FILE   *musicin;
@@ -1542,7 +1590,6 @@
     return musicin;
-#endif /* defined(LIBSNDFILE) */
diff -uNr ../lame-3.98.4.orig//frontend/get_audio.h .//frontend/get_audio.h
--- ../lame-3.98.4.orig//frontend/get_audio.h	2007-10-14 20:54:32.000000000 +0100
+++ .//frontend/get_audio.h	2011-05-27 17:34:42.000000000 +0100
@@ -74,7 +74,8 @@
 #include "sndfile.h"
+#endif /* ifdef LIBSNDFILE */
  * LAME/ISO built in audio file I/O routines 
@@ -102,7 +103,4 @@
 extern int parse_aiff(const char fn]);
 extern void aiff_check(const char *, IFF_AIFF *, int *);
-#endif /* ifdef LIBSNDFILE */
 #endif /* ifndef LAME_GET_AUDIO_H */
diff -uNr ../lame-3.98.4.orig//frontend/main.h .//frontend/main.h
--- ../lame-3.98.4.orig//frontend/main.h	2008-04-13 22:27:14.000000000 +0100
+++ .//frontend/main.h	2011-06-10 17:51:04.000000000 +0100
@@ -34,6 +34,7 @@
 /* GLOBAL VARIABLES used by parse.c and main.c.  
    instantiated in parce.c.  ugly, ugly */
+extern int force_internal;
 extern sound_file_format input_format;
 extern int swapbytes;        /* force byte swapping   default=0 */
 extern int silent;
diff -uNr ../lame-3.98.4.orig//frontend/parse.c .//frontend/parse.c
--- ../lame-3.98.4.orig//frontend/parse.c	2009-12-11 22:44:25.000000000 +0000
+++ .//frontend/parse.c	2011-06-10 17:54:23.000000000 +0100
@@ -92,6 +92,7 @@
 /* GLOBAL VARIABLES.  set by parse_args() */
 /* we need to clean this up */
+int force_internal = 0;
 sound_file_format input_format;
 int     swapbytes = 0;       /* force byte swapping   default=0 */
 int     silent;              /* Verbosity */
@@ -2121,12 +2122,13 @@
                         disable_wav_header = 0;
                     case 'r': /* force raw pcm input file */
-#if defined(LIBSNDFILE)
-                        error_printf
-                            ("WARNING: libsndfile may ignore -r and perform fseek's on the input.
-                             "Compile without libsndfile if this is a problem.
                         input_format = sf_raw;
+                        /* WARNING: libsndfile may ignore -r and 
+                           perform fseek's on the input (ie it fails)
+                           so force use of lame's internal i/o
+                        */
+                        force_internal = 1;
                     case 'x': /* force byte swapping */
                         swapbytes = 1;

Lews, thanks very much for the work.The same happened to me, and your post fixed it.

Best regards, Andy