GNOME Bugzilla – Bug 162974
[flacenc] Flac encoding is broken
Last modified: 2005-01-16 15:59:36 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.
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
$ ./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?
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.
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.
Created attachment 35481 [details] [review] try1 If that's the case, then this patch should fix it. Untested.
Thanks. Solved all my problems :)
Thanks for the patch, Ronald!
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.
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.
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.
Hm, that's another change in 1.1.1 then. I'll get packages somewhere and try until it works...
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.
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.
*** Bug 164252 has been marked as a duplicate of this bug. ***