androidijkplayer

deinterlace video when playing with IJKPlayer


There are exact four entries when searching google about deinterlaced play back with IJKPlayer. The best one seems to be this. However, the mentioned solution by adding

mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "vf0", "yadif")

to the code doesn't seem to work. Of course, when using ffplay (or ffmpeg) it's all about filters beeing included or not. So, is there any working solution available, which deinterlaces with IJKPlayer and tells which filters to use (during compiletime and runtime), idiot-proof?

EDIT:

I found, that the player has been compiled with --disable-avfilter. I checked out the latest version from git and compiled it with --enable-avfilter. Now, directory android/contrib/build/ffmpeg-armv7a/output/lib contains libavfilter.a, also. libijkffmpeg.so is bigger in size and running

nm -D --defined-only libijkffmpeg.so

shows the symbol vf_yadif. However, IJKPlayer still doesn't deinterlace when using with option vf0/yadif.

I added version info for avfilter, too:

I/IJKMEDIA: ===== versions =====
I/IJKMEDIA: ijkplayer    : k0.8.0
I/IJKMEDIA: FFmpeg       : ff3.3--ijk0.8.0--20170518--001
I/IJKMEDIA: libavutil    : 55.58.100
I/IJKMEDIA: SDL_RunThread: [32440] ff_msg_loop
I/IJKMEDIA: libavcodec   : 57.89.100
I/IJKMEDIA: libavformat  : 57.71.100
I/IJKMEDIA: libavfilter  : 6.82.100
I/IJKMEDIA: libswscale   : 4.6.100
I/IJKMEDIA: libswresample: 2.7.100

Solution

  • Finally, I found the solution for it:

    This is how to use deinterlacing with IJKPlayer on android:

    // FIXME: merge filter related code and enable it // remove these lines to enable avfilter #ifdef CONFIG_AVFILTER #undef CONFIG_AVFILTER #endif #define CONFIG_AVFILTER 0

    The player now supports deinterlacing by setting:

    mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "vf0", "yadif");
    

    This has to be done before mediaPlayer.start().

    Since deinterlacing is a time consuming job, I had to play with the yadif options, to get it running on my device, nicely. I'm using it with "yadif=2". See the official FFmpeg documentation for more details about yadif.