I use ffmpeg to decode flv frame to yuv420p.But I don't know how 开发者_开发百科to display it on android help me please!!
I recently published some code we were using for FFMPEG on Android:
https://github.com/churnlabs/android-ffmpeg-sample/blob/master/jni/native.c
That first function, fill_bitmap(), fills an Android bitmap with the contents of an AVFrame buffer.
Not the most efficient way to do it, but it's working code. The Android bitmap is an ARGB_8888 and I just set the alpha to zero. Seemed like the best match for the formats the sws_scale() contexts supported.
yuv420p format is not supported on android. you need to convert to one of the formats android supports. find the formats here. You can use FFMPEG's sws_scale function to convert the format from yuv420p to one of the required formats.
Alternatively you can also look at ffplay.c or ffmpeg tutorial for how the conversion is performed.
精彩评论