GNOME Bugzilla – Bug 776962
flacenc: Conversion from m4a encapsuled alac to flac fail with: Could not initialize supporting library.
Last modified: 2017-01-14 15:23:53 UTC
After trying to debug soundconverter I discovered the problem comes from gstreamer : gst-launch-0.10 filesrc location="/home/francois/Bureau/test.m4a" ! queue ! decodebin name=decoder ! audioconvert ! flacenc ! filesink location=test.flac fail with : Setting pipeline to PAUSED ... Pipeline is PREROLLING ... ERROR: from element /GstPipeline:pipeline0/GstFlacEnc:flacenc0: Could not initialize supporting library. Additional debug info: gstflacenc.c(829): gst_flac_enc_set_format (): /GstPipeline:pipeline0/GstFlacEnc:flacenc0: could not initialize encoder (wrong parameters?) ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... Freeing pipeline ... But gst-launch-0.10 filesrc location="/home/francois/Bureau/test.m4a" ! queue ! decodebin name=decoder ! autoaudiosink works as well as : gst-launch-0.10 giosrc location="file:///home/francois/Bureau/test.m4a" name=src ! decodebin name=decoder ! audioconvert ! vorbisenc quality=0.6 ! oggmux ! giosink location="file:///home/francois/Bureau/test.ogg" Verbose output of gst-launch-0.10 -v filesrc location="/home/francois/Bureau/test.m4a" ! queue ! decodebin name=decoder ! audioconvert ! flacenc ! filesink location=test.flac Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstDecodeBin:decoder/GstTypeFindElement:typefind.GstPad:src: caps = audio/x-m4a Pipeline is PREROLLING ... /GstPipeline:pipeline0/GstDecodeBin:decoder/GstQTDemux:qtdemux0.GstPad:sink: caps = audio/x-m4a /GstPipeline:pipeline0/GstDecodeBin:decoder/GstQueue:queue0.GstPad:sink: caps = audio/x-alac, codec_data=(buffer)00000024616c616300000000000010000010280a0e0200ff00002c23000b11470000ac44, samplesize=(int)16, rate=(int)44100, channels=(int)2 /GstPipeline:pipeline0/GstDecodeBin:decoder/GstQueue:queue0.GstPad:src: caps = audio/x-alac, codec_data=(buffer)00000024616c616300000000000010000010280a0e0200ff00002c23000b11470000ac44, samplesize=(int)16, rate=(int)44100, channels=(int)2 /GstPipeline:pipeline0/GstDecodeBin:decoder/ffdec_alac:ffdec_alac0.GstPad:sink: caps = audio/x-alac, codec_data=(buffer)00000024616c616300000000000010000010280a0e0200ff00002c23000b11470000ac44, samplesize=(int)16, rate=(int)44100, channels=(int)2 /GstPipeline:pipeline0/GstDecodeBin:decoder/ffdec_alac:ffdec_alac0.GstPad:src: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstDecodeBin:decoder.GstGhostPad:src0: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstDecodeBin:decoder.GstGhostPad:src0.GstProxyPad:proxypad1: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstAudioRate:audiorate0.GstPad:sink: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstAudioRate:audiorate0.GstPad:src: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstAudioRate:audiorate0.GstPad:sink: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:src: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:sink: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstAudioResample:audioresample0.GstPad:src: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstAudioResample:audioresample0.GstPad:sink: caps = audio/x-raw-int, rate=(int)44100, channels=(int)2, signed=(boolean)true, endianness=(int)1234, width=(int)16, depth=(int)16 /GstPipeline:pipeline0/GstFlacEnc:flacenc0.GstPad:src: caps = audio/x-flac, channels=(int)2, rate=(int)44100 ERROR: from element /GstPipeline:pipeline0/GstFlacEnc:flacenc0: Could not initialize supporting library. Additional debug info: gstflacenc.c(829): gst_flac_enc_set_format (): /GstPipeline:pipeline0/GstFlacEnc:flacenc0: could not initialize encoder (wrong parameters?) ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... /GstPipeline:pipeline0/GstFlacEnc:flacenc0.GstPad:src: caps = NULL /GstPipeline:pipeline0/GstAudioResample:audioresample0.GstPad:src: caps = NULL /GstPipeline:pipeline0/GstAudioResample:audioresample0.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:src: caps = NULL /GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstAudioRate:audiorate0.GstPad:src: caps = NULL /GstPipeline:pipeline0/GstAudioRate:audiorate0.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstDecodeBin:decoder.GstGhostPad:src0: caps = NULL /GstPipeline:pipeline0/GstDecodeBin:decoder/ffdec_alac:ffdec_alac0.GstPad:src: caps = NULL /GstPipeline:pipeline0/GstDecodeBin:decoder/ffdec_alac:ffdec_alac0.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstDecodeBin:decoder/GstQueue:queue0.GstPad:src: caps = NULL /GstPipeline:pipeline0/GstDecodeBin:decoder/GstQueue:queue0.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstDecodeBin:decoder/GstQTDemux:qtdemux0.GstPad:audio_00: caps = NULL /GstPipeline:pipeline0/GstDecodeBin:decoder/GstQTDemux:qtdemux0.GstPad:sink: caps = NULL /GstPipeline:pipeline0/GstDecodeBin:decoder/GstTypeFindElement:typefind.GstPad:src: caps = NULL Freeing pipeline ...
Thanks for the bug report, but GStreamer 0.10 is no longer maintained or supported. Please re-open the bug if you can still reproduce the issue with a recent version of 1.x, e.g. >= 1.10.
Sorry my bad. I can reproduce it with gst-launch-1.0 (GStreamer 1.10.2)
Ok, could you make a GST_DEBUG=*:6 log available please? $ GST_DEBUG=*:6 gst-launch-1.0 .... 2>dbg.log $ xz -9 dbg.log then attach dbg.log.xz to this bug report, thanks!
Created attachment 343040 [details] Result of GST_DEBUG=*:6 gst-launch-1.0 2>dbg.log
The log only contains: ERROR: pipeline could not be constructed: empty pipeline not allowed. Could you please create another log, but this time replace the .... above with your actual conversion pipeline?
Created attachment 343474 [details] Same with actual command
Thanks, and now again please with gst-launch-1.0 (not 0.10) :)
Created attachment 343475 [details] Once again but with brain switched on this time...
Thanks! So according to the log FLAC__stream_encoder_init_stream() fails with: FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA, /**< The metadata input to the encoder is invalid, in one of the following ways: * - FLAC__stream_encoder_set_metadata() was called with a null pointer but a block count > 0 * - One of the metadata blocks contains an undefined type * - It contains an illegal CUESHEET as checked by FLAC__format_cuesheet_is_legal() * - It contains an illegal SEEKTABLE as checked by FLAC__format_seektable_is_legal() * - It contains more than one SEEKTABLE block or more than one VORBIS_COMMENT block */ My suspicion is that this is related to: gst_flac_enc_peer_query_total_samples: peer reported duration 0:01:32.040000000 gst_flac_enc_peer_query_total_samples: Upstream reported 0 total samples (It should've converted to samples using the sample rate.) Would it be possible for you to make the input file available somewhere for me to look at? Then I can figure out exactly why it fails.
Sure, but keep in mind that it failed with ALL my alac files (created with XLD or iTunes). https://flcloud.ovh/s/a0SgiwWBT95hj9c
Thanks, I can reproduce this now with your file.
Has got to do with the embedded coverart and how we pass it on to flac. Will fix later.
Should be fixed in git master now, thanks for the bug report and the sample file! qtdemux would extract the coverart image as PREVIEW_IMAGE and we would then hand that to flac and mark it as a file icon type image. I don't know why exactly flac refused that, but it's probably either because it's not actually a PNG (which is a requirement for image type 1) or because it's not actually 32x32 (which is a requirement for image type 1). commit 5404304facbec97e8d6d31370b8ea6ba89572336 Author: Tim-Philipp Müller <tim@centricular.com> Date: Sat Jan 14 15:16:53 2017 +0000 qtdemux: boldly assume that first 'covr' image is the front cover commit 59fd44a56faf2fa71cdc74f45dac5f4a985359dd Author: Tim-Philipp Müller <tim@centricular.com> Date: Sat Jan 14 15:09:07 2017 +0000 qtdemux: extract cover art images into GST_TAG_IMAGE not PREVIEW_IMAGE These are usually much bigger than icon size and required by iTunes to be certain fairly large sizes. In qtmux it is also the IMAGE tags which we write out as 'covr' atoms. commit bc6a9327f47438bb3598ba8c4f5e9b8b1db8385d Author: Tim-Philipp Müller <tim@centricular.com> Date: Sat Jan 14 15:05:36 2017 +0000 flacenc: also set PICTURE tag width and height if available commit 23fb9ead5d072fd82e86bbbcc8493f0d5cecca66 Author: Tim-Philipp Müller <tim@centricular.com> Date: Sat Jan 14 14:58:52 2017 +0000 flacenc: fix encoder init error with some GST_TAG_PREVIEW_IMAGEs The encoder fails to initialise when we try to set GST_TAG_PREVIEW_IMAGEs sent to use by qtdemux from iTunes-generated m4a files. We should not just blindly translate the PREVIEW tag to file icon image types, but check if the specific conditions required are met (i.e. image type 1 must be a 32x32 PNG icon, and what we're getting is 500x500). https://bugzilla.gnome.org/show_bug.cgi?id=776962