{"action":"created","issue":{"url":"https://api.github.com/repos/Bilibili/ijkplayer/issues/855","repository_url":"https://api.github.com/repos/Bilibili/ijkplayer","labels_url":"https://api.github.com/repos/Bilibili/ijkplayer/issues/855/labels{/name}","comments_url":"https://api.github.com/repos/Bilibili/ijkplayer/issues/855/comments","events_url":"https://api.github.com/repos/Bilibili/ijkplayer/issues/855/events","html_url":"https://github.com/Bilibili/ijkplayer/issues/855","id":127396995,"number":855,"title":"怎么用mediacodec播放hevc视频？","user":{"login":"Long888","id":14835622,"avatar_url":"https://avatars.githubusercontent.com/u/14835622?v=3","gravatar_id":"","url":"https://api.github.com/users/Long888","html_url":"https://github.com/Long888","followers_url":"https://api.github.com/users/Long888/followers","following_url":"https://api.github.com/users/Long888/following{/other_user}","gists_url":"https://api.github.com/users/Long888/gists{/gist_id}","starred_url":"https://api.github.com/users/Long888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Long888/subscriptions","organizations_url":"https://api.github.com/users/Long888/orgs","repos_url":"https://api.github.com/users/Long888/repos","events_url":"https://api.github.com/users/Long888/events{/privacy}","received_events_url":"https://api.github.com/users/Long888/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-01-19T09:04:32Z","updated_at":"2016-02-26T03:04:59Z","closed_at":null,"body":"我在播放播放hevc视频的时候发现音视频不同步，后来查看日志发现没有调用mediacodec解码，是用的软解。芯片也是支持H265硬解码的，编译时我已经加上了和hevc相关的选项，代码里也设置相关的参数，但是就是不会调用mediacodec解码。\r\n\r\nCode：\r\n\tIjkMediaPlayer ijkMediaPlayer = null;\r\n\t\t\tif (mUri != null) {\r\n\t\t\t\tijkMediaPlayer = new IjkMediaPlayer();\r\n\t\t\t\tIjkMediaPlayer.native_setLogLevel(IjkMediaPlayer.IJK_LOG_INFO);\r\n\r\n\t\t\t\tif (mSettings.getUsingMediaCodec()) {\r\n\t\t\t\t\tijkMediaPlayer\r\n\t\t\t\t\t\t\t.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\t\t\t\"mediacodec\", 1);\r\n\t\t\t\t\tijkMediaPlayer.setOption(\r\n\t\t\t\t\t\t\tIjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\t\"mediacodec_all_videos\", 1);\r\n\t\t\t\t\tijkMediaPlayer.setOption(\r\n\t\t\t\t\t\t\tIjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\t\"mediacodec_hevc\", 1);\r\n\t\t\t\t\tif (mSettings.getUsingMediaCodecAutoRotate()) {\r\n\t\t\t\t\t\tijkMediaPlayer.setOption(\r\n\t\t\t\t\t\t\t\tIjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\t\t\"mediacodec-auto-rotate\", 1);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tijkMediaPlayer.setOption(\r\n\t\t\t\t\t\t\t\tIjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\t\t\"mediacodec-auto-rotate\", 0);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tijkMediaPlayer\r\n\t\t\t\t\t\t\t.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\t\t\t\"mediacodec\", 0);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (mSettings.getUsingOpenSLES()) {\r\n\t\t\t\t\tijkMediaPlayer.setOption(\r\n\t\t\t\t\t\t\tIjkMediaPlayer.OPT_CATEGORY_PLAYER, \"opensles\", 1);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tijkMediaPlayer.setOption(\r\n\t\t\t\t\t\t\tIjkMediaPlayer.OPT_CATEGORY_PLAYER, \"opensles\", 0);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tString pixelFormat = mSettings.getPixelFormat();\r\n\t\t\t\tif (TextUtils.isEmpty(pixelFormat)) {\r\n\t\t\t\t\tijkMediaPlayer.setOption(\r\n\t\t\t\t\t\t\tIjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\t\"overlay-format\", IjkMediaPlayer.SDL_FCC_RV32);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tijkMediaPlayer.setOption(\r\n\t\t\t\t\t\t\tIjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\t\"overlay-format\", pixelFormat);\r\n\t\t\t\t}\r\n\t\t\t\tijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\"framedrop\", 1);\r\n\t\t\t\tijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,\r\n\t\t\t\t\t\t\"start-on-prepared\", 0);\r\n\r\n\t\t\t\t// ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,\r\n\t\t\t\t// \"http-detect-range-support\", 0);\r\n\r\n\t\t\t\tijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC,\r\n\t\t\t\t\t\t\"skip_loop_filter\", 48);\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nLog:\r\n\r\n01-19 16:42:05.279: D/IJKMEDIA(28607): JJKLoader: OK: 'java.nio.ByteBuffer' loaded\r\n01-19 16:42:05.279: D/IJKMEDIA(28607): JJKLoader: OK: 'java.util.ArrayList' loaded\r\n01-19 16:42:05.279: D/IJKMEDIA(28607): JJKLoader: OK: 'android.os.Build$VERSION' loaded\r\n01-19 16:42:05.279: D/IJKMEDIA(28607): JJKLoader: OK: 'android.os.Build' loaded\r\n01-19 16:42:05.279: D/IJKMEDIA(28607): JJKLoader: OK: 'android.media.AudioTrack' loaded\r\n01-19 16:42:05.279: I/IJKMEDIA(28607): API-Level: 19\r\n01-19 16:42:05.279: D/IJKMEDIA(28607): JJKLoader: OK: 'android.media.MediaCodec$BufferInfo' loaded\r\n01-19 16:42:05.329: D/IJKMEDIA(28607): JJKLoader: OK: 'android.media.MediaCodec' loaded\r\n01-19 16:42:05.339: D/IJKMEDIA(28607): JJKLoader: OK: 'android.media.MediaFormat' loaded\r\n01-19 16:42:05.339: D/IJKMEDIA(28607): JJKLoader: OK: 'android.os.Bundle' loaded\r\n01-19 16:42:05.339: D/IJKMEDIA(28607): JJKLoader: OK: 'tv.danmaku.ijk.media.player.IjkMediaPlayer' loaded\r\n01-19 16:42:05.339: D/IJKMEDIA(28607): JJKLoader: OK: 'tv.danmaku.ijk.media.player.misc.IMediaDataSource' loaded\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_native_init\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_native_setup\r\n01-19 16:42:05.369: I/IJKMEDIA(28607): av_version_info: ff2.8--ijk0.4.1.1--dev0.3.3--rc4\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ffpipeline_create_from_android()\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_set_inject_opaque(0x1d2002ba)\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_set_inject_opaque()=void\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_android_set_mediacodec_select_callback()\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ffpipeline_set_mediacodec_select_callback\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_android_set_mediacodec_select_callback()=void\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_native_setLogLevel(4)\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): moncleanup\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setOptionLong\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setDataSourceAndHeaders\r\n01-19 16:42:05.369: V/IJKMEDIA(28607): setDataSource: path http://127.0.0.1:9104\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_set_data_source(url=\"http://127.0.0.1:9104\")\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_set_data_source(url=\"http://127.0.0.1:9104\")=0\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_setVideoSurface\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_set_android_surface(surface=0x5cf0001d)\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ffpipeline_set_surface()\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_set_android_surface(surface=0x5cf0001d)=void\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): IjkMediaPlayer_prepareAsync\r\n01-19 16:42:05.369: D/IJKMEDIA(28607): ijkmp_prepare_async()\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): ===== versions =====\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): FFmpeg       : ff2.8--ijk0.4.1.1--dev0.3.3--rc4\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): libavutil    : 54.31.100\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): libavcodec   : 56.60.100\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): libavformat  : 56.40.101\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): libswscale   : 3.1.101\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): libswresample: 1.2.101\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): ===== options =====\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): player-opts : mediacodec                   = 1\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): player-opts : mediacodec_all_videos        = 1\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): player-opts : mediacodec_hevc              = 1\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): player-opts : mediacodec-auto-rotate       = 1\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): player-opts : opensles                     = 0\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): player-opts : overlay-format               = 842225234\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): player-opts : framedrop                    = 1\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): player-opts : start-on-prepared            = 0\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): format-opts : ijkinject-opaque             = 488637114\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): codec-opts  : skip_loop_filter             = 48\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): ===================\r\n01-19 16:42:05.379: D/IJKMEDIA(28607): ijkmp_prepare_async()=0\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): SDL_RunThread: [28710] ff_msg_loop\r\n01-19 16:42:05.379: D/IJKMEDIA(28607): message_loop\r\n01-19 16:42:05.379: D/IJKMEDIA(28607): FFP_MSG_FLUSH:\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): SDL_RunThread: [28712] ff_read\r\n01-19 16:42:05.379: I/IJKMEDIA(28607): SDL_RunThread: [28711] ff_vout\r\n01-19 16:42:07.119: E/IJKMEDIA(28607): Option ijkinject-opaque not found.\r\n01-19 16:42:07.399: I/IJKMEDIA(28607): max_frame_duration: 10.000\r\n01-19 16:42:07.399: I/IJKMEDIA(28607): Input #0, mpegts, from 'http://127.0.0.1:9104':\r\n01-19 16:42:07.409: I/IJKMEDIA(28607):   Duration: \r\n01-19 16:42:07.409: I/IJKMEDIA(28607): N/A\r\n01-19 16:42:07.409: I/IJKMEDIA(28607): , start: \r\n01-19 16:42:07.409: I/IJKMEDIA(28607): 8649.526800\r\n01-19 16:42:07.409: I/IJKMEDIA(28607): , bitrate: \r\n01-19 16:42:07.409: I/IJKMEDIA(28607): N/A\r\n01-19 16:42:07.409: I/IJKMEDIA(28607):   Program 1 \r\n01-19 16:42:07.409: I/IJKMEDIA(28607):     Metadata:\r\n01-19 16:42:07.409: I/IJKMEDIA(28607):       service_name    : \r\n01-19 16:42:07.409: I/IJKMEDIA(28607): Service01\r\n01-19 16:42:07.409: I/IJKMEDIA(28607):       service_provider: \r\n01-19 16:42:07.409: I/IJKMEDIA(28607): FFmpeg\r\n01-19 16:42:07.409: I/IJKMEDIA(28607):     Stream #0:0\r\n01-19 16:42:07.409: I/IJKMEDIA(28607): [0x100]\r\n01-19 16:42:07.409: I/IJKMEDIA(28607): : Video: hevc (Main) ([36][0][0][0] / 0x0024), yuv420p(tv), 1280x720\r\n01-19 16:42:07.409: I/IJKMEDIA(28607): , \r\n01-19 16:42:07.409: I/IJKMEDIA(28607): 60 tbr, \r\n01-19 16:42:07.409: I/IJKMEDIA(28607): 90k tbn, \r\n01-19 16:42:07.409: I/IJKMEDIA(28607): 90k tbc\r\n01-19 16:42:07.409: I/IJKMEDIA(28607):     Stream #0:1\r\n01-19 16:42:07.409: I/IJKMEDIA(28607): [0x101]\r\n01-19 16:42:07.409: I/IJKMEDIA(28607): : Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 70 kb/s\r\n01-19 16:42:07.429: I/IJKMEDIA(28607): SDL_Android_AudioTrack: CHANNEL_OUT_STEREO\r\n01-19 16:42:07.429: I/IJKMEDIA(28607): SDL_Android_AudioTrack: ENCODING_PCM_16BIT\r\n01-19 16:42:07.449: I/IJKMEDIA(28607): SDL_Android_AudioTrack_new_from_spec: init volume as 1.000000/(1.000000,0.000000)\r\n01-19 16:42:07.449: I/IJKMEDIA(28607): audio_session_id = 69\r\n01-19 16:42:07.449: I/IJKMEDIA(28607): AudioCodec: avcodec, aac\r\n01-19 16:42:07.449: I/IJKMEDIA(28607): SDL_RunThread: [28724] ff_audio_dec\r\n01-19 16:42:07.449: I/IJKMEDIA(28607): SDL_RunThread: [28723] ff_aout_android\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): ffpipenode_create_video_decoder_from_android_mediacodec()\r\n01-19 16:42:07.449: I/IJKMEDIA(28607): API-Level: 19\r\n01-19 16:42:07.449: E/IJKMEDIA(28607): ffpipenode_create_video_decoder_from_android_mediacodec: MediaCodec/HEVC is disabled. codec_id:1211250229 \r\n01-19 16:42:07.449: I/IJKMEDIA(28607): VideoCodec: avcodec, hevc\r\n01-19 16:42:07.449: W/IJKMEDIA(28607): fps: 60.000000 (too high)\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): FFP_MSG_VIDEO_SIZE_CHANGED: 1280, 720\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): FFP_MSG_SAR_CHANGED: 0, 1\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): ijkmp_get_msg: FFP_MSG_PREPARED\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): FFP_MSG_PREPARED:\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): IjkMediaPlayer_start\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): ijkmp_start()\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): ijkmp_start()=0\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): IjkMediaPlayer_start\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): ijkmp_start()\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): ijkmp_start()=0\r\n01-19 16:42:07.449: D/IJKMEDIA(28607): ijkmp_get_msg: FFP_REQ_START\r\n01-19 16:42:07.449: I/IJKMEDIA(28607): SDL_RunThread: [28728] ff_video_dec\r\n01-19 16:42:07.549: D/IJKMEDIA(28607): ijkmp_get_msg: FFP_REQ_START\r\n01-19 16:42:07.779: D/IJKMEDIA(28607): SDL_VoutFFmpeg_CreateOverlay(w=1280, h=720, fmt=RV32(0x32335652, dp=0x66cea990)\r\n01-19 16:42:07.779: D/IJKMEDIA(28607): FFP_MSG_VIDEO_SIZE_CHANGED: 1280, 720\r\n01-19 16:42:07.799: D/IJKMEDIA(28607): Video: first frame decoded\r\n01-19 16:42:07.809: D/IJKMEDIA(28607): ANativeWindow_setBuffersGeometry: w=1280, h=720, f=\u0004(0x4) => w=1280, h=720, f=RV32(0x32335652)\r\n01-19 16:42:07.839: D/IJKMEDIA(28607): FFP_MSG_VIDEO_RENDERING_START:\r\n01-19 16:42:07.839: D/IJKMEDIA(28607): SDL_VoutFFmpeg_CreateOverlay(w=1280, h=720, fmt=RV32(0x32335652, dp=0x66cea990)\r\n01-19 16:42:07.839: D/IJKMEDIA(28607): FFP_MSG_VIDEO_SIZE_CHANGED: 1280, 720\r\n01-19 16:42:07.839: D/IJKMEDIA(28607): avcodec/Audio: first frame decoded\r\n01-19 16:42:07.849: D/IJKMEDIA(28607): FFP_MSG_AUDIO_RENDERING_START:\r\n01-19 16:42:07.879: D/IJKMEDIA(28607): FFP_MSG_VIDEO_SIZE_CHANGED: 1280, 720\r\n01-19 16:42:07.879: D/IJKMEDIA(28607): SDL_VoutFFmpeg_CreateOverlay(w=1280, h=720, fmt=RV32(0x32335652, dp=0x66cea990)\r\n"},"comment":{"url":"https://api.github.com/repos/Bilibili/ijkplayer/issues/comments/189089151","html_url":"https://github.com/Bilibili/ijkplayer/issues/855#issuecomment-189089151","issue_url":"https://api.github.com/repos/Bilibili/ijkplayer/issues/855","id":189089151,"user":{"login":"andyjmzheng","id":14343289,"avatar_url":"https://avatars.githubusercontent.com/u/14343289?v=3","gravatar_id":"","url":"https://api.github.com/users/andyjmzheng","html_url":"https://github.com/andyjmzheng","followers_url":"https://api.github.com/users/andyjmzheng/followers","following_url":"https://api.github.com/users/andyjmzheng/following{/other_user}","gists_url":"https://api.github.com/users/andyjmzheng/gists{/gist_id}","starred_url":"https://api.github.com/users/andyjmzheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyjmzheng/subscriptions","organizations_url":"https://api.github.com/users/andyjmzheng/orgs","repos_url":"https://api.github.com/users/andyjmzheng/repos","events_url":"https://api.github.com/users/andyjmzheng/events{/privacy}","received_events_url":"https://api.github.com/users/andyjmzheng/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T03:04:59Z","updated_at":"2016-02-26T03:04:59Z","body":"恩。\r\n"}}