Skip to content
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

Is it possible to stream MediaCodec outputbuffer to FFmpegFrameRecorder? #665

Open
MarsVard opened this issue Apr 6, 2017 · 11 comments
Open

Comments

@MarsVard
Copy link

MarsVard commented Apr 6, 2017

I'm trying to stream MediaCodec that records a surface over RTMP.

I understand that MediaCodec buffer is a raw h264 frame. How would I go about converting this to the correct format to feed to the FFmpegFrameRecorder?

@saudet
Copy link
Member

saudet commented Apr 6, 2017

Most likely yes. Please try to use packets: #93

@MarsVard
Copy link
Author

MarsVard commented Apr 6, 2017

@saudet Is there a working example of this?

@saudet
Copy link
Member

saudet commented Apr 7, 2017

/cc @alicanalbayrak @Baobomb You guys have anything?

@balbelias
Copy link

Hi, @saudet !

Are there any updates on this question?

I googled around and found this project
There MediaCodec and ffmpeg almost finely mixed together. I converted it into gradle based project and translated all ffmpeg calls to JNI calls using javaCV. And it work almost good: write long video with good stable fps. I still can't make it split video into ts files which seems like missconfiguration.

My first thought was to implement conversion between MediaCodec's output buffer and FFMpegFrameRecorder's input packet, but I have had no luck with that.

There you said it's needed to add a support for RAW (H264?) packets which seems to be exactly what I have tried to do.

I know this issue was pushed many times and I am sorry for doing it again but I am in real need in it. So I would greatly appreciate if you can kindly guid me or give an advice for next steps.

@saudet
Copy link
Member

saudet commented Apr 23, 2017

@balbelias I'm sorry, I don't have any more information about that. That's why I labeled this issue with "help wanted". If you do put the effort into making this work, please consider making a contribution back! Thank you

@balbelias
Copy link

@saudet ok! I see, it's more about FFMPEG than JavaCV. But what did you mean by "add support for RAW packets"?

@saudet
Copy link
Member

saudet commented Apr 24, 2017

Support for packets was added here: #372

@saudet
Copy link
Member

saudet commented Jul 18, 2018

BTW, FFmpeg supports MediaCodec now and we should be able to use it easily like this, for example:
#945 (comment)

@alexey-pelykh
Copy link

But how to construct AVFormatContext from MediaCodec output format? The only suggestion that I've seen is to dump few frames into FFmpegFrameGrabber (https://github.com/OnlyInAmerica/FFmpegTest)

@saudet
Copy link
Member

saudet commented Feb 20, 2023

@alexey-pelykh We can do it with FFmpeg for sure. Contributions are welcome!

@saudet
Copy link
Member

saudet commented Mar 3, 2023

BTW, FFmpeg 6.0 now supports hardware accelerated encoding using MediaCodec, so we don't need to use its API directly anymore. Please give it a try with the snapshots: http://bytedeco.org/builds/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants