Mobile-SDK-Android icon indicating copy to clipboard operation
Mobile-SDK-Android copied to clipboard

Anybody of DJI able to explain or confirm the YUY formats?

Open neilyoung opened this issue 5 years ago • 44 comments

I'm noticing at least two different YUV formats, potentially four different, as output of this interface?

public void onYuvDataReceived(final ByteBuffer yuvFrame, int dataSize, final int width, final int height)

So far FORMAT_I420 (the default) (on a Mavic Pro) and FORMAT_NV12 (on a Spark) have been spotted, but the original DJI sample code suggests, that there is at least also a FORMAT_NV21 drone flying out there

http://www.fourcc.org/pixel-format/yuv-i420/ http://www.fourcc.org/pixel-format/yuv-nv12/ http://www.fourcc.org/pixel-format/yuv-nv21/

neilyoung avatar Jul 11 '19 13:07 neilyoung

Such an easy question. No answer. Not even via the official dev support channel. Thanks

neilyoung avatar Jul 12 '19 06:07 neilyoung

@neilyoung - Dev Support maybe in a different time zone then you. I’m sure someone will help out soon.

LisaFedane avatar Jul 12 '19 07:07 LisaFedane

Hehe. True, but only if they live on Mars. I asked the same question several times already using [email protected]. Nothing. The question is open and unanswered since June now. Is this good support? I doubt that.

neilyoung avatar Jul 12 '19 07:07 neilyoung

@neilyoung - I’m sorry to hear that. Can you tell me your ticket #s with [email protected] and we can look into the delay.

LisaFedane avatar Jul 12 '19 07:07 LisaFedane

24417, May 29th Asked again by mail, e.g onJune 26, but I remember a couple of mails more.

neilyoung avatar Jul 12 '19 07:07 neilyoung

@neilyoung - it sounds like the dev agents are investigating this for you and waiting for responses from internal resources. I understand it may seem like an easy question but it's also not information Dev Support has at it's finger tips. I do see that they are working on this and I appreciate your patience. I kindly request not opening anymore tickets since it is being worked on and you have not been forgotten!

dji-lisafedane avatar Jul 12 '19 17:07 dji-lisafedane

Yes, I have heard that several times already. Thanks anyway.

neilyoung avatar Jul 12 '19 18:07 neilyoung

https://github.com/DJI-Mobile-SDK-Tutorials/Android-VideoStreamDecodingSample There is a simple sample.

Hujunjob avatar Jul 16 '19 03:07 Hujunjob

@Hujunjob You are missing the point. I'm aware of the sample. Please read my initial post again. Thanks

neilyoung avatar Jul 16 '19 11:07 neilyoung

I have the same problem

Hujunjob avatar Jul 17 '19 08:07 Hujunjob

@Hujunjob What specifically do you mean by that? You are also seeing the different YUV formats?

neilyoung avatar Jul 17 '19 08:07 neilyoung

sometimes I got nv12 sometimes I got nv21.

Hujunjob avatar Jul 17 '19 08:07 Hujunjob

True that. Thanks for confirmation. Be prepared to see also I420 and YV12. They are mixing up everything w/o telling, e.g. by a format specifier in the callback or so. I mean, this is an EXPORTED SDK INTERFACE, and it is neither documented nor is their first level support knowing anything about it...

neilyoung avatar Jul 17 '19 08:07 neilyoung

@Hujunjob Please confirm: You are NOT getting these different formats on ONE AND THE SAME, but on DIFFERENT drones, right?

neilyoung avatar Jul 17 '19 09:07 neilyoung

@Hujunjob Could you please confirm?

neilyoung avatar Jul 23 '19 11:07 neilyoung

Got an answer from DJI support today, which doesn't satisfy me:

The engineer informs that “The MSDK use the system's MediaCodec to decode the video stream and YUV format has no relationship with the aircraft model. After mCodecManager.enabledYuvData(true) calling, the following format is used to output the YUV data. format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar); ".

If that means, that DJI ensures I420 internally, then this cannot be true, since a couple of other formats have been seen at output level. See above.

neilyoung avatar Jul 23 '19 11:07 neilyoung

DJI support clarified the answer, and the current status is:

  • The format of the return of yuvDataCallback is not related to the type of the drone, it is determined by the capabilities of the underlaying Android system.
  • They will provide a function to communicate the returned format in later versions of the SDK. I would suggest to put it as an extra parameter into the yuvDataCallback, just like width and height now.

Meanwhile I'm trying to get some information, how I could predict the format by probably using another Android or DJI SDK function, which tells me that. If somebody has some info on this, please share.

neilyoung avatar Jul 25 '19 06:07 neilyoung

@neilyoung Can you provide which phones you have tested and what you think is the right setting for each? Perhaps it is possible to branch based on the phone model.

I can say that I tested this functionality on Samsung and LG phones and the format was I420. I don't have any other phones to try, but I got reports of customers having bad video when they were using a Huawei device.

ayavilevich avatar Aug 11 '19 12:08 ayavilevich

@ayavilevich I personally have tested it on a Nexus 6p, which delivered I420. A Honor 8 with Android 7 delivered NV21

ghost avatar Aug 11 '19 13:08 ghost

@ayavilevich I personally have tested it on a Nexus 6p, which delivered I420. A Honor 8 with Android 7 delivered NV21

Sorry, this was me from another account, accidently.

neilyoung avatar Aug 11 '19 13:08 neilyoung

@Hujunjob can you update on the Android phones you have used and the formats you got?

ayavilevich avatar Aug 11 '19 16:08 ayavilevich

@ayavilevich I think the best option you have (until DJI will provide a way to determine the delivered format, which is announced to come with the next release, probably 4.11) is to be prepared to see every possible YUV incarnation. In my code I'm ready to decode IUV, NV12, NV21 and YV12, which should basically cover all variations of YUV 4:2:0. I have to let it up to the customer to choose the appropriate format by configuration.

More on this here https://github.com/accuware/djistreamerlib

neilyoung avatar Aug 11 '19 16:08 neilyoung

4.11 is out and nothing has changed. Me was promised, that the next SDK version will feedback the YUV format. Nothing happened. What a $&%3252

neilyoung avatar Sep 24 '19 09:09 neilyoung

the yuv callback has changed , void onYuvDataReceived(MediaFormat format, ByteBuffer yuvFrame, int dataSize, int width, int height),now the MediaFormat is added,through this you can know the format of output data

Hoker- avatar Sep 24 '19 09:09 Hoker-

Ah cool. I just checked the sample. That didn’t reflect this. Thanks

Hoker [email protected] schrieb am Di. 24. Sept. 2019 um 11:53:

the yuv callback has changed , void onYuvDataReceived(MediaFormat format, ByteBuffer yuvFrame, int dataSize, int width, int height),now the MediaFormat is added,through this you can know the format of output data

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dji-sdk/Mobile-SDK-Android/issues/422?email_source=notifications&email_token=AHJ7KLMOM66DTXV5UAQR6MDQLHPRXA5CNFSM4IBFWW32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7NZK4Y#issuecomment-534484339, or mute the thread https://github.com/notifications/unsubscribe-auth/AHJ7KLIXD6K453M7TXFQKRDQLHPRXANCNFSM4IBFWW3Q .

-- Sent from my iPhone

ghost avatar Sep 24 '19 09:09 ghost

@neilyoung pls check out the reply of @Hoker-

Michael-DJI avatar Sep 24 '19 10:09 Michael-DJI

Did. Thanks.

Michael [email protected] schrieb am Di. 24. Sept. 2019 um 12:25:

@neilyoung https://github.com/neilyoung pls check out the reply of @Hoker- https://github.com/Hoker-

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dji-sdk/Mobile-SDK-Android/issues/422?email_source=notifications&email_token=AAFSPDA2VLMWLU67QAQ5FR3QLHTK3A5CNFSM4IBFWW32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7N4EAI#issuecomment-534495745, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFSPDHVCZXEXJDIV6IB23TQLHTK3ANCNFSM4IBFWW3Q .

-- Sent from my iPhone

neilyoung avatar Sep 24 '19 10:09 neilyoung

@Hoker- Is there any documentation about the changes compared to 4.10?

neilyoung avatar Sep 24 '19 12:09 neilyoung

@neilyoung For the changes please check out the release notes one day later

Michael-DJI avatar Sep 24 '19 17:09 Michael-DJI

@Michael-DJI When do you think is an update of the sample app available?

I notice two differences:

ConnectionActivity.java There is a new delegate:

                        @Override
                        public void onDatabaseDownloadProgress(long l, long l1) {

                        }

Not sure, what to do with it.

Then DJIVideoStreamDecoder.java: I don't need that, but there is a reference to onYuvDataReceived. Having set "mediaformat" to null for now.

Please clarify.

neilyoung avatar Sep 24 '19 18:09 neilyoung