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

MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface #10

Closed
Nook2007 opened this issue Apr 30, 2016 · 4 comments
Closed

MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface #10

Nook2007 opened this issue Apr 30, 2016 · 4 comments
Labels

Comments

@Nook2007
Copy link

Hi, can i use MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface for MediaFormat.KEY_COLOR_FORMAT to get data from surface?

@begeekmyfriend
Copy link
Owner

begeekmyfriend commented May 1, 2016

There seems no difference between MediaCodec and MediaRecorder that way. Actually yasea needs some pre-processing on getting the YUV frames from the camera before sending them into the encoder like cropping, flipping and rotation. For instance, the original video data source in android is a landscape picture and what I want is a portrait one, then I need to rotate and may also flip the whole YUV frame.

COLOR_FormatSurface can really work indeed. But if I do not know the specific color format, how do I make transformation of the YUV frames on pre-processing?

@Nook2007
Copy link
Author

Nook2007 commented May 1, 2016

We don't need pre-process frames, at the output we get raw h264 (with COLOR_FormatSurface or another, it does not matter) from mediacodec. I noticed that when use COLOR_FormatSurface - SPS and PPS are not sent. I'm trying to add them (SrsRtmpFlv.writeSampleData()), but it still does not work
https://gist.github.com/Nook2007/92f460c87d8556d35ab5676f40a5e840

@begeekmyfriend
Copy link
Owner

begeekmyfriend commented May 2, 2016

Where is your raw h.264 data from? Does it wrapped in the byte buffer returned by getOutputBuffers() of MediaCodec? Typically the SPS and PPS are wrapped in the IDR frame generated by the encoder if you do not miss them.

The gist code seems unreliable. The IDR frame is NOT always the first one from the encoder. See SrsFlvMuxer.java to find out the right way.

After all I am afraid I will not try your case on yasea for I am busy with other issues.

@lynx-liu
Copy link

lynx-liu commented Jul 8, 2016

@Nook2007 我的也是H264的祼数据, 希望通过writeSampleData来推流, 没有成功, 请问你怎么解决的呢

This was referenced Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants