Solution: cannot export to M4A / AAC because Gstream has changed their plugin API

Bug #1912876 reported by Wang Xuancong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Audio Recorder
New
Undecided
Unassigned

Bug Description

When saving recorded audio in M4A / AAC format, it gives the following error:
gst_object_unref: assertion 'object != NULL' failed
Error:To support m4a format you should install Gstreamer-plugins for .
Error:Installation of Gstreamer-plugins failed (GST_INSTALL_PLUGINS_HELPER_MISSING).

I have checked that I have installed Gstreamer-plugins, and running Gstream command line can convert any audio into .m4a format:
gst-launch-1.0 filesrc location=/tmp/test.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! avenc_aac ! mp4mux ! filesink location=/home/xuancong/Desktop/test.m4a

Solution:
In media-profiles.c, the default profile for M4A is out-of-date as Gstreamer has changed their plugin API, changing the following line will solve the problem:

Existing wrong:
{"CD Quality, AAC 44KHz", "m4a", "", "audio/x-raw,rate=44100,channels=2 ! avenc_aac compliance=-2 ! avmux_mp4"}

New correct:
{"CD Quality, AAC 44KHz", "m4a", "", "audio/x-raw,rate=44100,channels=2 ! avenc_aac ! mp4mux"}

Thanks!
Xuancong

Tags: aac gstreamer m4a
Revision history for this message
moma (osmoma) wrote :

Hello Wang,

Many thanks for your finding.
I will fix the media-profiles.c file ASAP.

Notice:
I have not worked on audio-recorder for a long time now.
The entire code should be re-written, but that is a major task.

Thanks again Wang.
Well done.

 Cumprimentos
  Osmo Antero
   Portugal

Revision history for this message
moma (osmoma) wrote :

Hello Xuancong,

The new version is audio-recorder 3.2.2.

Changes:
https://bazaar.launchpad.net/~audio-recorder/audio-recorder/trunk/revision/1935

I have only re-compiled packages for Ubuntu 20.10 (Groovy, Ubuntu`s development version).
Launchpad is now compiling the packages for audio-recorder - 3.2.2~groovy.
https://launchpad.net/~audio-recorder/+archive/ubuntu/ppa/+packages

But I might be able to copy the packages over to Ubuntu 20.04.
Launchpad.net has a copy package function.
I will try it now.

Cumprimentos
  Osmo Antero
   Portugal

Revision history for this message
moma (osmoma) wrote :

Re-hello,

I have some problems recording (to .m4a) from the audio-recorder GUI, even the command line in a terminal window works fine.

$ gst-launch-1.0 -e pulsesrc ! queue ! audioresample ! audioconvert ! audio/x-raw,rate=44100,channels=2 ! avenc_aac ! mp4mux ! filesink location=test.m4a

I have to test it better later on.

Please test the new version 3.2.2 and tell your findings. Is it ok?

Cumprimentos
  Osmo Antero
   Portugal

Revision history for this message
moma (osmoma) wrote : Re: [Bug 1912876] Re: Solution: cannot export to M4A / AAC because Gstream has changed their plugin API
Download full text (3.4 KiB)

Hello again,
I can now see why the m4a pipeline records well on the command line, but
fails in the GUI (when run by audio-recorder).

This pipeline is ok.
gst-launch-1.0 -e pulsesrc ! queue ! audioresample ! audioconvert !
audio/x-raw,rate=44100,channels=2 ! avenc_aac ! mp4mux ! filesink
location=test.m4a

This fails.
gst-launch-1.0 pulsesrc ! queue ! audioresample ! audioconvert !
audio/x-raw,rate=44100,channels=2 ! avenc_aac ! mp4mux ! filesink
location=test.m4a

The difference is the -e (--eos-on-shutdown) option.
See:
$ gst-launch-1.0 --help
...
-e, --eos-on-shutdown Force EOS on sources before shutting the pipeline
down
...
----------
The GUI does not issue the --eos-on-shutdown option, therefore the test.m4a
file is not valid.
I think the -e option caused some problems or freezing earlier and was
removed.
Let us see if it is/was in the code.

$ cd trunk
$ grep "eos" src/*.c

src/gst-pipeline.c: // Add -e (--eos-on-shutdow) option.
src/gst-recorder.c: // gst_element_send_event(g_pipeline,
gst_event_new_eos());
src/gst-recorder.c:static void rec_eos_msg_cb(GstBus *bus, GstMessage *msg,
void *userdata) {
src/gst-recorder.c: g_signal_connect(bus, "message::eos",
G_CALLBACK(rec_eos_msg_cb), NULL);

Most pipelines work fine without the -e (EOS) message.
Obviously mp4mux is not happy without it.

I will see into this issue later on.

Cumprimentos
  Osmo Antero
   Portugal

moma <email address hidden> escreveu no dia domingo, 24/01/2021 à(s)
11:51:

> Re-hello,
>
> I have some problems recording (to .m4a) from the audio-recorder GUI,
> even the command line in a terminal window works fine.
>
>
> $ gst-launch-1.0 -e pulsesrc ! queue ! audioresample ! audioconvert !
> audio/x-raw,rate=44100,channels=2 ! avenc_aac ! mp4mux ! filesink
> location=test.m4a
>
> I have to test it better later on.
>
> Please test the new version 3.2.2 and tell your findings. Is it ok?
>
> Cumprimentos
> Osmo Antero
> Portugal
>
> --
> You received this bug notification because you are subscribed to Audio
> Recorder.
> https://bugs.launchpad.net/bugs/1912876
>
> Title:
> Solution: cannot export to M4A / AAC because Gstream has changed their
> plugin API
>
> Status in Audio Recorder:
> New
>
> Bug description:
> When saving recorded audio in M4A / AAC format, it gives the following
> error:
> gst_object_unref: assertion 'object != NULL' failed
> Error:To support m4a format you should install Gstreamer-plugins for .
> Error:Installation of Gstreamer-plugins failed
> (GST_INSTALL_PLUGINS_HELPER_MISSING).
>
>
> I have checked that I have installed Gstreamer-plugins, and running
> Gstream command line can convert any audio into .m4a format:
> gst-launch-1.0 filesrc location=/tmp/test.mp3 ! mpegaudioparse !
> mpg123audiodec ! audioconvert ! avenc_aac ! mp4mux ! filesink
> location=/home/xuancong/Desktop/test.m4a
>
>
> Solution:
> In media-profiles.c, the default profile for M4A is out-of-date as
> Gstreamer has changed their plugin API, changing the following line will
> solve the problem:
>
> Existing wrong:
> {"CD Quality, AAC 44KHz", "m4a", "", "audio/x-raw,rate=44100,channels=2
> ! avenc_aac compliance=-2 ! avmux_mp4"}
...

Read more...

Revision history for this message
Wang Xuancong (xuancong84) wrote :

Thanks Osmo Antero.
From your code, I can see that working on C/C++ is quite inefficient,
future GUI should also use Python which is much easier.

Cheers,
xuancong

On Sun, Jan 24, 2021 at 7:20 PM moma <email address hidden> wrote:

> Hello Xuancong,
>
> The new version is audio-recorder 3.2.2.
>
> Changes:
>
> https://bazaar.launchpad.net/~audio-recorder/audio-recorder/trunk/revision/1935
>
> I have only re-compiled packages for Ubuntu 20.10 (Groovy, Ubuntu`s
> development version).
> Launchpad is now compiling the packages for audio-recorder - 3.2.2~groovy.
> https://launchpad.net/~audio-recorder/+archive/ubuntu/ppa/+packages
>
>
> But I might be able to copy the packages over to Ubuntu 20.04.
> Launchpad.net has a copy package function.
> I will try it now.
>
> Cumprimentos
> Osmo Antero
> Portugal
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1912876
>
> Title:
> Solution: cannot export to M4A / AAC because Gstream has changed their
> plugin API
>
> Status in Audio Recorder:
> New
>
> Bug description:
> When saving recorded audio in M4A / AAC format, it gives the following
> error:
> gst_object_unref: assertion 'object != NULL' failed
> Error:To support m4a format you should install Gstreamer-plugins for .
> Error:Installation of Gstreamer-plugins failed
> (GST_INSTALL_PLUGINS_HELPER_MISSING).
>
>
> I have checked that I have installed Gstreamer-plugins, and running
> Gstream command line can convert any audio into .m4a format:
> gst-launch-1.0 filesrc location=/tmp/test.mp3 ! mpegaudioparse !
> mpg123audiodec ! audioconvert ! avenc_aac ! mp4mux ! filesink
> location=/home/xuancong/Desktop/test.m4a
>
>
> Solution:
> In media-profiles.c, the default profile for M4A is out-of-date as
> Gstreamer has changed their plugin API, changing the following line will
> solve the problem:
>
> Existing wrong:
> {"CD Quality, AAC 44KHz", "m4a", "", "audio/x-raw,rate=44100,channels=2
> ! avenc_aac compliance=-2 ! avmux_mp4"}
>
> New correct:
> {"CD Quality, AAC 44KHz", "m4a", "", "audio/x-raw,rate=44100,channels=2
> ! avenc_aac ! mp4mux"}
>
> Thanks!
> Xuancong
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/audio-recorder/+bug/1912876/+subscriptions
>

Revision history for this message
moma (osmoma) wrote :
Download full text (3.9 KiB)

Hi,
Yes, the gst_element_send_event(...) was earlier commented out in
the rec_stop_recording(...) function.

I have to find a better solution.

Osmo Antero

Osmo Antero <email address hidden> escreveu no dia domingo, 24/01/2021 à(s)
13:44:

> Hello again,
> I can now see why the m4a pipeline records well on the command line, but
> fails in the GUI (when run by audio-recorder).
>
> This pipeline is ok.
> gst-launch-1.0 -e pulsesrc ! queue ! audioresample ! audioconvert !
> audio/x-raw,rate=44100,channels=2 ! avenc_aac ! mp4mux ! filesink
> location=test.m4a
>
> This fails.
> gst-launch-1.0 pulsesrc ! queue ! audioresample ! audioconvert !
> audio/x-raw,rate=44100,channels=2 ! avenc_aac ! mp4mux ! filesink
> location=test.m4a
>
> The difference is the -e (--eos-on-shutdown) option.
> See:
> $ gst-launch-1.0 --help
> ...
> -e, --eos-on-shutdown Force EOS on sources before shutting the pipeline
> down
> ...
> ----------
> The GUI does not issue the --eos-on-shutdown option, therefore the
> test.m4a file is not valid.
> I think the -e option caused some problems or freezing earlier and was
> removed.
> Let us see if it is/was in the code.
>
> $ cd trunk
> $ grep "eos" src/*.c
>
> src/gst-pipeline.c: // Add -e (--eos-on-shutdow) option.
> src/gst-recorder.c: // gst_element_send_event(g_pipeline,
> gst_event_new_eos());
> src/gst-recorder.c:static void rec_eos_msg_cb(GstBus *bus, GstMessage
> *msg, void *userdata) {
> src/gst-recorder.c: g_signal_connect(bus, "message::eos",
> G_CALLBACK(rec_eos_msg_cb), NULL);
>
> Most pipelines work fine without the -e (EOS) message.
> Obviously mp4mux is not happy without it.
>
> I will see into this issue later on.
>
> Cumprimentos
> Osmo Antero
> Portugal
>
> moma <email address hidden> escreveu no dia domingo, 24/01/2021
> à(s) 11:51:
>
>> Re-hello,
>>
>> I have some problems recording (to .m4a) from the audio-recorder GUI,
>> even the command line in a terminal window works fine.
>>
>>
>> $ gst-launch-1.0 -e pulsesrc ! queue ! audioresample ! audioconvert !
>> audio/x-raw,rate=44100,channels=2 ! avenc_aac ! mp4mux ! filesink
>> location=test.m4a
>>
>> I have to test it better later on.
>>
>> Please test the new version 3.2.2 and tell your findings. Is it ok?
>>
>> Cumprimentos
>> Osmo Antero
>> Portugal
>>
>> --
>> You received this bug notification because you are subscribed to Audio
>> Recorder.
>> https://bugs.launchpad.net/bugs/1912876
>>
>> Title:
>> Solution: cannot export to M4A / AAC because Gstream has changed their
>> plugin API
>>
>> Status in Audio Recorder:
>> New
>>
>> Bug description:
>> When saving recorded audio in M4A / AAC format, it gives the following
>> error:
>> gst_object_unref: assertion 'object != NULL' failed
>> Error:To support m4a format you should install Gstreamer-plugins for .
>> Error:Installation of Gstreamer-plugins failed
>> (GST_INSTALL_PLUGINS_HELPER_MISSING).
>>
>>
>> I have checked that I have installed Gstreamer-plugins, and running
>> Gstream command line can convert any audio into .m4a format:
>> gst-launch-1.0 filesrc location=/tmp/test.mp3 ! mpegaudioparse !
>> mpg123audiodec ! audioconvert ! avenc_aac ! mp4mux ! filesi...

Read more...

Revision history for this message
moma (osmoma) wrote :

Re-hi,

The latest version 3.2.3 should now record .m4a audio well.

Please see:
https://launchpad.net/~audio-recorder/+archive/ubuntu/ppa
audio-recorder 3.2.3~hirsute
audio-recorder 3.2.3~groovy

Obrigado
  Osmo Antero

Revision history for this message
Marcel Seydel (marcelspunkt-deactivatedaccount) wrote :

Hello,

i'm using the new Version. Installed on Arch Linux 5.10.15 over the AUR
https://aur.archlinux.org/packages/audio-recorder/

If I try to record aac-m4a files, it wont work and i get such error messages:

(audio-recorder:5231): GStreamer-CRITICAL **: 13:06:16.703: gst_object_unref: assertion 'object != NULL' failed
Error:To support m4a format you should install Gstreamer-plugins for avenc_aac, avmux_mp4.
Error:Installation of Gstreamer-plugins failed (GST_INSTALL_PLUGINS_HELPER_MISSING).
Error:Error:Missing Gstreamer element: avenc_aac.
Installation string for avenc_aac: gstreamer|1.0|audio-recorder|GStreamer-Element avenc_aac|element-avenc_aac.
Error:Missing Gstreamer element: avmux_mp4.
Installation string for avmux_mp4: gstreamer|1.0|audio-recorder|GStreamer-Element avmux_mp4|element-avmux_mp4.

gst-plugins-bad from official repositories is installed:
https://archlinux.org/packages/extra/x86_64/gst-plugins-bad/

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.