How to make my ExoPlayer to support software decoder especially while streaming of mkv container?
I have searched a lot for this everyone posted portions or half code.
I have URL that plays a mkv video with quality 1080p the problem is in my app and in MX Player with HW buffers more than 1- 5 mins. But when I switch the decoder to SW it plays the video instantly. I don't know how MX Player implemented Software Decoder. I want that too...
I have tried using Renderer Mode on, off and prefer it doesn't work at all....
https://github.com/androidx/media/assets/58415010/a6271af3-90e2-4ae2-9b77-ce5c0c6c84e4
Hello @yogesh-hacker
Thank you for reporting your issue. I believe that you are asking how you might force to use a software decoder?
An app can implement a workaround to remove a potential decoder as follows (bottom-up):
The app should override MediaCodecVideoRenderer.getDecoderInfos() roughly as follows:
protected List<MediaCodecInfo> getDecoderInfos(
MediaCodecSelector mediaCodecSelector, Format format, boolean requiresSecureDecoder)
throws DecoderQueryException {
List<MediaCodecInfo> decoderInfos = super.getDecoderInfos(mediaCodecSelector, format, requiresSecureDecoder);
if (//Insert condition here like specific sampleMimeType or format resolution is 1080p) {
// check if decoderInfos contains the decoder that is hardwareAccelerated
// if yes, return a copy of the decoderInfos list excluding that decoder
}
The app can inject the custom renderer by overriding DefaultRenderersFactory.buildVideoRenderers() The player should be created with your custom DefaultRenderersFactory by passing it in the ExoPlayer.Builder constructor, or with ExoPlayer.Builder.setRenderersFactory.
Hope that helps!
I am closing this ticket as there has not been any response on this issue since the query was answered.
If the suggestion did not address your issue then feel free to create a new ticket.
Ah! I am really sorry about that, I haven't noticed the notification, while your suggestion may help other developers, but in that mean time I developed a workaround for that SW and which is pretty good and smooth, like I am using currently ffmpeg for SW, I don't know if there any better options, but for me it's working fine. Once again I am really sorry about that I missed the notification, Thanks for Your precious reply. 🙂
Hi @yogesh-hacker , I’m currently exploring playback of HLS content using the software decoder, but I’m observing constant frame drops and lag when playing HLS profiles above SD resolution (≥480p). While researching possible solutions, I came across FFmpeg as a software decoding accelerator. From what I’ve gathered, Media3 seems to use FFmpeg only for audio decoding and not for video, but I may be mistaken. Could you please share any information or guidance on how to leverage FFmpeg for video decoding within Media3, or if there are any recommended approaches to improve software playback performance for higher-resolution content?