-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please create encode_aac.js example to show how to create AAC frames from raw PCM data. #84
Comments
I have some code like this to generate the raw audio frame data.
All I manage to get is crackling. test.mp4 |
Sounds like the pts is not correct. Playing WAY to fast. The pts should advance relative to the sample rate. If you are encoding at say 16khz, then the encoder timebase should be set to 1/16000. This tells the encoder to expect 16000 individual samples per second. Since aac is 1024 samples per frame, you would need to inject 15.625 frames (of 1024 samples each) per second. PTS should advance by 1024 each time you write an audio frame, so that the pts is 16000 at the end of the first second. Same with video. if you are using standard MP4 timebase of 1/90000 then pts should equal 90000 at the end of the first second. Which means PTS advancement depends on frame rate. At 30fps video, each video frame PTS should advance by 3000. (because 90000/30 = 3000) |
Some progress. The issue now is that I'm not sure if my the I've tried appending all the AAC packets into a file but nothing seems to play it back. |
I am trying to produce raw packets from RGB and PCM data.
Thanks to the
encode_h264.js
I can create video frames from RGB, but a simple example of how to produce AAC data is not available.I have seen others here struggling with the same. What may seem simple and obvious to you is inscrutable to us mere mortals.
All the examples I have tried, most them are unstable (lots of crashes). The only data I get out does not seem to start with a recognisable AAC header.
eg.
The muxing examples produce mp4 files with silence.
Can you please provide a simple working example that could help a lot of us with a starting point to dynamic PCM -> AAC encoding?
The text was updated successfully, but these errors were encountered: