I wanna stream to facebook live from android. I was able to adapt an existing example for streaming to FB.
That first step more or less works (audio is still a problem, but not in the scope her). I can stream to FB.
I now wanna overlay the stream with a transparent png image.
I am creating a FFmpegFrameFilter on start up by:
try{
filter = new FFmpegFrameFilter("movie="+path+"/image.png [logo];[in][logo]overlay=0:0:format=rgb [out]",imageWidth, imageHeight);
filter.start();
}catch (FrameFilter.Exception e){
Log.e(CLASS_LABEL,"Error while starting filter: "+e.getMessage());
e.printStackTrace();
}
and on each frame i do the following:
filter.push(yuvImage);
Frame frame;
while ((frame = filter.pull()) != null) {
recorder.record(frame,avutil.AV_PIX_FMT_NV21);
}
The problem is that i have no idea which pixel format i should use. My overlay image has rgb colors (https://postimg.org/image/f1ri3vj43/)
With the above pixel format i get something like this: https://postimg.org/image/45ha64q9z/
I am pretty frustrated since i already tried many pixel formats. All with a different output, sometimes the logo appears multiple times.
Is there a way to find out which one i should choose from the avutil.java possibilities?
EDIT: You can find the whole code on https://github.com/y4nnick/android_streaming/blob/master/app/src/main/java/com/example/yannick/olay1/RecordActivity.java
EDIT: I allready tried the following formats:
// AV_PIX_FMT_ARGB --> 4 at once, all black/white
// AV_PIX_FMT_0RGB --> 4 at once, all black/white
// AV_PIX_FMT_BGR8 --> 1 a bit to big, strange colors
// AV_PIX_FMT_BGR4_BYTE --> 1 a bit to big, stranger blue tint
// AV_PIX_FMT_YUVA422P_LIBAV --> error: Cannot initialize the conversion context.
// AV_PIX_FMT_FLAG_ALPHA --> error: Cannot initialize the conversion context.
// AV_PIX_FMT_FLAG_PLANAR --> error: Cannot initialize the conversion context.
// AV_PIX_FMT_RGB4 --> error: Cannot initialize the conversion context.
// AV_PIX_FMT_RGB32_1 --> 4 at a time, all black/white
// AV_PIX_FMT_0BGR --> 4 at a time, all black/white
// AV_PIX_FMT_YVYU422 --> 2 side by side, gruen, purple tint
// AV_PIX_FMT_YUVJ422P --> Fatal signal 11 (SIGSEGV) at 0x61f7xf000 (code=1), thread 18401 (e.yannick.olay1)
// AV_PIX_FMT_BAYER_BGGR8 --> 1 a bit to big, black/white
// AV_PIX_FMT_BAYER_GBRG8 --> 1 a bit to big, black/white
// AV_PIX_FMT_FLAG_RGB --> 2 a bit to big, black/white
// AV_PIX_FMT_RGB555LE --> 2 a bit to big, strange colors
// AV_PIX_FMT_RGB555BE --> 2 a bit to big, strange colors
// AV_PIX_FMT_RGB555 --> 2 a bit to big, strange colors
// AV_PIX_FMT_RGB4_BYTE --> 1 a bit to big, orange tint
// AV_PIX_FMT_RGBA64 --> 8 side by side, black/white
// AV_PIX_FMT_RGB24 --> 3 side by side, red tint