After examining the generated files, I noticed that they are not exactly 1 second long. Running ffprobe on one of the files shows that the duration is approximately 1.02 seconds instead of precisely 1 second.
AAC will (typically) encode frames of 1024 samples, so your chunk size will be a multiple of 1024 samples.
In your case it’s probably 44 frames at 1024 samples = 45056 samples, divided by 44100 samples per second = 1.021678005s
I think the only way to get exactly 1 second chunks is to find an AAC encoder that encodes 960 samples per frame in combination with a 48kHz sample rate.
I don’t think any of the libraries/encoders available in GStreamer can support that out of the box though.
Hello, @tpm Thank you for your insightful response. You are absolutely right.
After discussing with my team, we decided to implement this logic accordingly. I have rewritten the pipeline in Python and added a probe function connected to the last multifilesink element:
I would like to trigger file saving inside the if statement. Given that the multifilesink element (aac_sink) is passed as a parameter to the function, how can I manually trigger file saving on multifilesink? I also thought about using splitmuxsink and running emit("split-now") however because of the mp4mux inside the splitmuxsink, it does not return raw aac files, but encapsulates them in mp4.