GNOME Bugzilla – Bug 148993
Gstreamer fails to play Faac created aac file
Last modified: 2004-12-22 21:47:04 UTC
I created a simple aac file using faac. But gstreamer fails to play it : cartman@southpark:~$ gst-launch filesrc location=excellent.aac ! spider ! audioconvert ! audioscale! artsdsink RUNNING pipeline ... artsdsink: closed connection ERROR: from element /pipeline0/spider0/sink_ident: Could not determine type of stream. Execution ended after 2 iterations (sum 1420951000 ns, average 710475500 ns, min 301000 ns, max 1420650000 ns). artsdsink: closed connection
Created attachment 30137 [details] Problematic aac file File to reproduce problem
We don't have an AAC parser or typefind function, we only playback AAC-in-Quicktime.
Hi, just found this thread with Google... this is what the file properties in foobar2000 tell about your AAC file: bitrate = 52 channels = 2 samplerate = 22050 aac_profile = AAC LC aac_header_type = ADTS codec = AAC ---------- 26624 samples @ 22050Hz File size: 7 899 bytes Length: 0:01.207 It plays fine (sounding distorted though), and due to its short length the bitrate might not be displayed correct. Anyhow, if you want to encode an input file or bitstream directly to the MP4 format with FAAC, you would have to use either the -w or the -o switch (with *.mp4 as file extension) on the command line. This only works if FAAC has been compiled with libmp4v2 support, the MPEG4IP library for writing MP4 files. See also http://www.audiocoding.com/modules/wiki/?page=FAAC On the other hand I think that gstreamer should be able to decode plain AAC files with an AAC parser (maybe without), because they use FAAD2 for playback, the open source AAC decoder from Audiocoding.com that can also understand these files, even if they don't have any headers (= raw), but then with additional input switches supplying the missing info about used profile etc.
Created attachment 31835 [details] [review] Allows playing .aac files This patch adds buffer management to the FAAD filter so it can play .aac files (no typefinding though). With this patch, I can play your file with the following command: gst-launch-0.8 filesrc location=test.aac ! faad ! audioconvert ! audioscale ! esdsink I also removed the source pad renegotiation in gst_faad_sinkconnect() since it caused the following assertion when using spider after qtdemux: (process:8868): GStreamer-CRITICAL **: file gstpad.c: line 1434 (gst_pad_renegotiate): assertion `GST_PAD_LINK_SINK (pad)' failed
typefinding for .aac is already included in gst-plugins-0.8.4 (I'm still using 0.8.2). So "faad" can be replaced by "spider" to decode .aac files.
You use a static buffer + size member in the GstFaad struct. Can you change that to use gst_buffer_merge() and gst_buffer_create_sub()? I don't like the static array because it allows for overflows.
Created attachment 32077 [details] [review] patch to play .aac files This one uses a GstBuffer instead of a char array.
Good going! Now you actually need a gst_buffer_unref () for both input buffers after the _join() (yes, that's ugly, but it changes interface so we will only fix that in 0.9). Apart from that, I'd say just commit this.
Are you sure I need to unref the buffers? Running `gst-launch --trace` doesn't show me any live buffer at the end and the documentation says that the buffers are unreffed for join() but not for merge(). GstBuffer * gst_buffer_join (GstBuffer * buf1, GstBuffer * buf2) { GstBuffer *result; /* we're just a specific case of the more general gst_buffer_span() */ result = gst_buffer_span (buf1, 0, buf2, buf1->size + buf2->size); gst_buffer_unref (buf1); gst_buffer_unref (buf2); return result; }
Oops, I don't even know my own API. Yes, you're correct, sorry.
Lovely, works fine. Applied, thanks a lot!