-
Notifications
You must be signed in to change notification settings - Fork 131
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
transcode to memory #15
Comments
i have the same issue. i did the greater part where i could get the data into memory but i can't get the header itself. |
I've do some kind of thing for audio decoding of (xbox) XMA2 multistream from and to memory. First, you need to write your own AVIOContext for the input :
Here the context is just a wrapper around a Juce's (C++ Framework) MemoryInputStream instance that is just a stream that read a MemoryBlock that contain my audio file datas. For a simple input, you need to provide two (static) callback functions to the constructor (read & seek), but you can add your own 'write' callback too. For the output of the decoder, i've juste create a FrameSink instance that record the ffmpeg packet to a raw AudioSampleBuffer (always a Juce class), inspired by the audio decode demo :
Now this is the main class that use both of the two previous classes, inspired by the Demuxer class, I just play around the audio stream but you can adapt the idea to a video/audio demuxer in memory.
The most important part come in the constructor :
I provide first my Juce's input stream, and a reference to the audio output buffer. You just put you private context to the main allocated context and initialize avformat simply like in this example. A simple init method is in public to allow to initialize your private FrameSink (RawAudioMemorySink for here), with the right audio stream index. The usage is more than simple, for me it's simply:
That's all. This is a draft way to do the trick, but hope that help! |
Is there a way to set up a muxer recipient to be memory instead of file?
I need the transcoded and muxed output in a memory buffer rather than written to file.
Thanks
Andrea
The text was updated successfully, but these errors were encountered: