Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm making IP streaming android application. In which I'm using exoplayer 2.12.0. Input video is having mpeg-L2 audio layer codec which is not supported by exoplayer https://github.com/google/ExoPlayer/issues/6525 . So i'm using ffmpeg extension to render audio.
I have followed https://github.com/google/ExoPlayer/tree/release-v2/extensions/ffmpeg steps to build ffmpeg extension with android-ndk-r21d-linux-x86_64 and FFmpeg-release-4.3.
Added code in the application
TrackSelector trackSelectors = new DefaultTrackSelector(new AdaptiveTrackSelection.Factory()); RenderersFactory renderersFactory=new DefaultRenderersFactory(this,EXTENSION_RENDERER_MODE_ON,DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS); player = ExoPlayerFactory.newSimpleInstance(this, renderersFactory,trackSelectors); Still audio is not coming and the log is as below
2020-12-01 05:05:10.803 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: videoEnabled [eventTime=1.39, mediaPos=0.00, window=0, period=0]
2020-12-01 05:05:10.808 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: tracks [eventTime=1.39, mediaPos=0.00, window=0, period=0, []]
2020-12-01 05:05:10.808 9161-9161/demo.demoapps.com.exoplayer2udpdemo I/MainActivity: onTracksChanged
2020-12-01 05:05:10.809 9161-9161/demo.demoapps.com.exoplayer2udpdemo I/MainActivity: 2
2020-12-01 05:05:10.809 9161-9161/demo.demoapps.com.exoplayer2udpdemo I/MainActivity: Format(2204/5204, null, null, video/mpeg2, null, -1, null, [720, 576, -1.0], [-1, -1])
2020-12-01 05:05:10.809 9161-9161/demo.demoapps.com.exoplayer2udpdemo I/MainActivity: Format(2204/6204, null, null, audio/mpeg-L2, null, -1, null, [-1, -1, -1.0], [2, 48000])
2020-12-01 05:05:10.813 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: downstreamFormat [eventTime=1.40, mediaPos=0.00, window=0, period=0, id=2204/5204, mimeType=video/mpeg2, res=720x576]
2020-12-01 05:05:10.827 9161-9219/demo.demoapps.com.exoplayer2udpdemo I/OMXClient: IOmx service obtained
2020-12-01 05:05:10.926 9161-9218/demo.demoapps.com.exoplayer2udpdemo D/SurfaceUtils: connecting to surface 0x6f5abb1010, reason connectToSurface
2020-12-01 05:05:10.928 9161-9218/demo.demoapps.com.exoplayer2udpdemo I/MediaCodec: [OMX.qcom.video.decoder.mpeg2] setting surface generation to 9380865
2020-12-01 05:05:10.928 9161-9218/demo.demoapps.com.exoplayer2udpdemo D/SurfaceUtils: disconnecting from surface 0x6f5abb1010, reason connectToSurface(reconnect)
2020-12-01 05:05:10.929 9161-9218/demo.demoapps.com.exoplayer2udpdemo D/SurfaceUtils: connecting to surface 0x6f5abb1010, reason connectToSurface(reconnect)
2020-12-01 05:05:10.941 9161-9219/demo.demoapps.com.exoplayer2udpdemo I/ExtendedACodec: setupVideoDecoder()
2020-12-01 05:05:10.950 9161-9219/demo.demoapps.com.exoplayer2udpdemo I/ExtendedACodec: Decoder will be in frame by frame mode
2020-12-01 05:05:10.995 9161-9219/demo.demoapps.com.exoplayer2udpdemo D/SurfaceUtils: set up nativeWindow 0x6f5abb1010 for 720x576, color 0x7fa30c06, rotation 0, usage 0x20002900
2020-12-01 05:05:11.014 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: videoDecoderInitialized [eventTime=1.60, mediaPos=0.00, window=0, period=0, OMX.qcom.video.decoder.mpeg2]
2020-12-01 05:05:11.015 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: videoInputFormat [eventTime=1.60, mediaPos=0.00, window=0, period=0, id=2204/5204, mimeType=video/mpeg2, res=720x576]
2020-12-01 05:05:11.060 9161-9219/demo.demoapps.com.exoplayer2udpdemo D/SurfaceUtils: set up nativeWindow 0x6f5abb1010 for 720x576, color 0x7fa30c06, rotation 0, usage 0x20002900
2020-12-01 05:05:11.101 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: videoSize [eventTime=1.69, mediaPos=0.00, window=0, period=0, 720, 576]
2020-12-01 05:05:11.153 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: surfaceSize [eventTime=1.74, mediaPos=0.00, window=0, period=0, 786, 590]
2020-12-01 05:05:11.180 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: renderedFirstFrame [eventTime=1.76, mediaPos=0.00, window=0, period=0, Surface(name=null)/@0x1c4f9a6]
2020-12-01 05:05:12.517 9161-9161/demo.demoapps.com.exoplayer2udpdemo I/MainActivity: onPlayerStateChanged: playWhenReady = true playbackState = 3
2020-12-01 05:05:12.517 9161-9161/demo.demoapps.com.exoplayer2udpdemo I/MainActivity: ExoPlayer ready! pos:
2020-12-01 05:05:12.518 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: state [eventTime=3.10, mediaPos=0.00, window=0, period=0, READY]
2020-12-01 05:05:12.523 9161-9161/demo.demoapps.com.exoplayer2udpdemo D/EventLogger: isPlaying [eventTime=3.11, mediaPos=0.00, window=0, period=0, true]

Here, With or without ffmpeg extension, I'm not getting audioEnabled log in Eventlogger. Also after using ffmpeg audio render, I'm not getting it is being used or not. Or am I missing some configuration of ffmpeg extension to Exoplayer?

Make sure that you did the following:

  • Place the extension .aar file to your project libs folder;
  • Add ‘*.aar’ to the import filters in your module’s build.gradle (there is only ‘*.jar’ by default):
  • compile fileTree(dir: 'libs', include: ['*.jar','*.aar'])
    
  • Make sure that FfmpegLibrary.isAvailable() returns true
  • If all above is done but extension doesn’s work try to use EXTENSION_RENDERER_MODE_PREFER instead of EXTENSION_RENDERER_MODE_ON

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.