0

Wondering if it is possible to encode using AAC into mp4 container

I have tried using the following

gst-launch-1.0 alsasrc device="hw:0,0" ! "audio/x-raw,rate=48000,channels=2,depth=16" ! queue ! audioconvert ! avenc_aac !  qtmux ! filesink location=audio.mp4

The program runs without a fault but when I inspect the file content, it gives me a null content

However when i run with avimux, the file content gives the encoding and details like lenght of audio

gst-launch-1.0 alsasrc device="hw:0,0" ! "audio/x-raw,rate=48000,channels=2,depth=16" ! queue ! audioconvert ! avenc_aac !  avimux ! filesink location=audio.mp4

Wander what is wrong as I would need AAC encoding (for later rtsp streaming) and need to use mp4 as container and qtmux

thanks

user1538798
  • 1,075
  • 3
  • 17
  • 42

1 Answers1

1

You don't really say what you are doing exactly. But most likely you are missing the -e option for gst-launch-1.0. With that an EOS signal is propagated through the pipleine to correctly finalize the mp4 file. Other file formats are not that picky, but mp4 needs to write a proper index when all samples have been written.

Florian Zwoch
  • 6,764
  • 2
  • 12
  • 21
  • Hi actually I am trying to test out part of my pipeline with gstreamer-launch before i commit to coding in C.. Test for helping – user1538798 Dec 13 '21 at 04:18
  • I think the important detail missing in your description here is that you abort the encoding with CTRL-C which is causing the MP4 corruption. But does it work for you with the `-e` switch? – Florian Zwoch Dec 13 '21 at 10:41
  • Hi how do you actually end the program? I mean can we use Ctrl Z? – user1538798 Dec 13 '21 at 13:15
  • I channced upon you comments in https://stackoverflow.com/questions/56329968/video-is-much-faster-than-audio-when-muxed-in-gstreamer. Now i know what to do – user1538798 Dec 13 '21 at 13:44