After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 162974 - [flacenc] Flac encoding is broken
[flacenc] Flac encoding is broken
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
git master
Other Linux
: Normal normal
: 0.8.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 164252 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-01-05 01:25 UTC by Marius Gravdal
Modified: 2005-01-16 15:59 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
try1 (2.32 KB, patch)
2005-01-05 14:46 UTC, Ronald Bultje
none Details | Review

Description Marius Gravdal 2005-01-05 01:25:21 UTC
Try to encode any source into a flac file results in this:

gst-launch filesrc location=01-talib_kweli-kay_slay_intro-mob.mp3 !
mad ! flacenc ! filesink location=/tmp/01.flac
RUNNING pipeline ...
ERROR: from element /pipeline0/flacenc0: Could not initialize supporting library.
Additional debug info:
gstflacenc.c(589): gst_flacenc_chain: /pipeline0/flacenc0:
could not initialize encoder (wrong parameters?)
Execution ended after 2 iterations (sum 12740000 ns, average 6370000 ns,
min 247000 ns, max 12493000 ns).

No matter the source or sink, flacenc just exits.
Comment 1 Zach Borgerding 2005-01-05 01:42:51 UTC
This happens to me as well:

FLAC 1.1.1
GST 0.8.7
GST-Plugins 0.8.6

FLAC encoding seems to have been broken for a long time (since early last year).
 I've just not really used GST-enabled encoding programs until recently.

For example:
http://sourceforge.net/mailarchive/message.php?msg_id=7610163
Comment 2 Ronald Bultje 2005-01-05 10:10:51 UTC
$ ./gst-launch-0.8 filesrc location=/home/rbultje/Media/music/After\ Forever\ -\
Ephemeral.mp3 ! mad ! audioconvert ! flacenc ! filesink location=/tmp/bla.flac

works for me (flac-1.1.0-4, gst cvs, also works without audioconvert although
you should use that for consistency). What distro do you use or, if you compiled
flac yourself, which tarball did you use?
Comment 3 Marius Gravdal 2005-01-05 13:01:54 UTC
Running slackware 10.0, compiled gstreamer from source (tried both 0.8.7 and
0.8.8), tried the last pre release of gst-plugins from 01042005. And I still get
the same error. Tried it with audioconvert too, which resulted in some "push on
peer of pad audioconvert0:src but peer is not active" errors.

Flac decoding works like a charm btw.
Comment 4 Zach Borgerding 2005-01-05 14:03:18 UTC
There were a few callback changes in libFLAC since 1.1.1 was released.  Might
this have something to do with it?:

# Added new required tell callback on seekable stream encoder:

    * FLAC__SeekableStreamEncoderTellStatus and
FLAC__SeekableStreamEncoderTellStatusString[]
    * FLAC__SeekableStreamEncoderTellCallback
    * FLAC__seekable_stream_encoder_set_tell_callback()

# Changed FLAC__SeekableStreamEncoderState by adding
FLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR
# Changed Tell callback is now required to initialize seekable stream encoder



This is the code snippet in gstflacenc.c that seems to be failing:

 if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) ==
      FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) {
    FLAC__SeekableStreamEncoderState state;

    FLAC__seekable_stream_encoder_set_write_callback (flacenc->encoder,
        gst_flacenc_write_callback);
    FLAC__seekable_stream_encoder_set_seek_callback (flacenc->encoder,
        gst_flacenc_seek_callback);

    FLAC__seekable_stream_encoder_set_client_data (flacenc->encoder, flacenc);

    gst_flacenc_set_metadata (flacenc);
    state = FLAC__seekable_stream_encoder_init (flacenc->encoder);
    if (state != FLAC__STREAM_ENCODER_OK) {
      GST_ELEMENT_ERROR (flacenc, LIBRARY, INIT, (NULL),
          ("could not initialize encoder (wrong parameters?)"));
      return;
    }


I think it's not initializing the seekable stream encoder as a result.
Comment 5 Ronald Bultje 2005-01-05 14:46:01 UTC
Created attachment 35481 [details] [review]
try1

If that's the case, then this patch should fix it. Untested.
Comment 6 Marius Gravdal 2005-01-05 16:43:59 UTC
Thanks. Solved all my problems :)
Comment 7 Zach Borgerding 2005-01-05 17:10:50 UTC
Thanks for the patch, Ronald!
Comment 8 Zach Borgerding 2005-01-06 00:00:04 UTC
Ronald, this patch seems to correct the problems with encoding.  It now works
with  libFLAC 1.1.1.  There is a problem still though.  It doesn't seem to
generate FLAC files with frame headers.  I've passed it to 3 different players
(MPlayer and two xine-lib programs) and none can seek to different points in the
FLAC file.

I've attempted to encode by command line and through SoundJuicer.  Both produce
the same results.

gst-launch-0.8 filesrc location=/media/ieee1394disk/mp3/\[kenna\]\ a\ better\
control.mp3 ! mad ! audioconvert ! flacenc ! filesink
location=/home/zborgerd/bla.flac

Is there an option that needs to be passed to get it to generate the frame
headers, or has this always been broken in GST's flacenc plugin?  This doesn't
seem to occur when I encode FLAC files through the "flac" binary.
Comment 9 Ronald Bultje 2005-01-06 00:23:44 UTC
Try totem-gst or RB. Worksforme. I don't know if xine or mplayer are broken.

What you might want to do, is generate Ogg/Flac files instead:

gst-launch-0.8 filesrc location=/media/ieee1394disk/mp3/\[kenna\]\ a\ better\
control.mp3 ! mad ! audioconvert ! flacenc ! oggmux ! filesink

Mplayer and such can definately seek in such files.
Comment 10 Zach Borgerding 2005-01-06 00:41:53 UTC
Ronald,

Thanks for the response.  It also fails with Totem-GST (We have a test build of
that one as well).  It plays back and sounds fine, but seek is broken (slider
just hangs at the far right side of the bar).  FLAC files that weren't encoded
through gst seem to be okay though.
Comment 11 Ronald Bultje 2005-01-06 09:40:09 UTC
Hm, that's another change in 1.1.1 then. I'll get packages somewhere and try
until it works...
Comment 12 Zach Borgerding 2005-01-07 04:49:17 UTC
I've noticed that running "flac -t file.flac" produces the following error:

-----------------------
bla.flac: tested 3833856 samplesbla.flac: *** Got error code
0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
bla.flac: ok
-----------------------

I'm examining changes to the FLAC 1.1.1 source to see if I can find anything,
but I'm not certain I'll be of much help.
Comment 13 Ronald Bultje 2005-01-09 20:00:00 UTC
Use the 'stream-subset=false' property to generate headers. This is only
required when not muxing it inside ogg. I've tried it and it works fine for me.
Marking fixed.
Comment 14 Sebastien Bacher 2005-01-16 15:59:36 UTC
*** Bug 164252 has been marked as a duplicate of this bug. ***