Mailing List Archive

Mediacodec playback of mpeg2 on fire stick 4k
Hi Aman

There is still the ongoing issue with decoding mpeg2 using mediacodec
through ffmpeg. The process hangs, and never gets any frames back.

As a separate project i have developed a pure android mythtv frontend
player, using java and the exoplayer library. It is working well and I
am surprised to find that it plays mpeg2 perfectly and also deinterlaces
it. Exoplayer uses pure mediacodec, there is no software video decoding.

Whatever the problem is with mediacodec and fire stick 4K, evidently
there must be a way around it.

If you need any more information please contact me.

Regards
Peter
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mediacodec playback of mpeg2 on fire stick 4k [ In reply to ]
Hi.

My experience with mediacodec and FireTV devices (both basic and 4K)
is that there's a pool of 4 surfaces max available.

So if you decode a frame and buffer it, once you have 4 frames
buffered the decoder will no longer output anything anymore until the
decoded frame and its surface has been rendered and marked as
available once again.

Seeing how much mythtv buffer before painting anything to the screen,
I wouldn't be surprised if you hit that problem

JY

On Mon, 9 Dec 2019 at 14:36, Peter Bennett <pb.mythtv@gmail.com> wrote:
>
> Hi Aman
>
> There is still the ongoing issue with decoding mpeg2 using mediacodec
> through ffmpeg. The process hangs, and never gets any frames back.
>
> As a separate project i have developed a pure android mythtv frontend
> player, using java and the exoplayer library. It is working well and I
> am surprised to find that it plays mpeg2 perfectly and also deinterlaces
> it. Exoplayer uses pure mediacodec, there is no software video decoding.
>
> Whatever the problem is with mediacodec and fire stick 4K, evidently
> there must be a way around it.
>
> If you need any more information please contact me.
>
> Regards
> Peter
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mediacodec playback of mpeg2 on fire stick 4k [ In reply to ]
On Mon, Dec 9, 2019 at 2:35 PM Peter Bennett <pb.mythtv@gmail.com> wrote:

> Hi Aman
>
> There is still the ongoing issue with decoding mpeg2 using mediacodec
> through ffmpeg. The process hangs, and never gets any frames back.


I have not experienced any such issue. You're not receiving even a single
frame back?

Are you creating the decoder with a Surface or not?


>
> As a separate project i have developed a pure android mythtv frontend
> player, using java and the exoplayer library. It is working well and I
> am surprised to find that it plays mpeg2 perfectly and also deinterlaces
> it. Exoplayer uses pure mediacodec, there is no software video decoding.
>
> Whatever the problem is with mediacodec and fire stick 4K, evidently
> there must be a way around it.
>
> If you need any more information please contact me.
>
> Regards
> Peter
>
Re: Mediacodec playback of mpeg2 on fire stick 4k [ In reply to ]
On 12/9/19 9:22 PM, Aman Gupta wrote:
>
>
> On Mon, Dec 9, 2019 at 2:35 PM Peter Bennett <pb.mythtv@gmail.com
> <mailto:pb.mythtv@gmail.com>> wrote:
>
> Hi Aman
>
> There is still the ongoing issue with decoding mpeg2 using mediacodec
> through ffmpeg. The process hangs, and never gets any frames back.
>
>
> I have not experienced any such issue. You're not receiving even a
> single frame back?
>
No frame is seen. This is only with fire stick 4k. It works fine on
Nvidia Shield.
> Are you creating the decoder with a Surface or not?
>
This is not using a surface, just decoding with ffmpeg into memory and
rendering after that with OpenGL. Mark Kendall is working on direct
rendering. I do not know if the same problem will happen there, as the
direct rendering is not currently in a working state.
>
>
>
> As a separate project i have developed a pure android mythtv frontend
> player, using java and the exoplayer library. It is working well
> and I
> am surprised to find that it plays mpeg2 perfectly and also
> deinterlaces
> it. Exoplayer uses pure mediacodec, there is no software video
> decoding.
>
> Whatever the problem is with mediacodec and fire stick 4K, evidently
> there must be a way around it.
>
> If you need any more information please contact me.
>
> Regards
> Peter
>
Re: Mediacodec playback of mpeg2 on fire stick 4k [ In reply to ]
Aman

On a slightly different note - can you tell me whether there is a way
to detect in advance what codecs any given MediaCodec implementation
actually supports?

I like to do as many up front checks as possible - and MediaCodec is
currently a bit of a black hole. Our code does fallback to software
decoding but it is not very clean (as we have to wait for decoding to
fail) and we lose a few frames as a result.

Thanks and regards
Mark

On Wed, 11 Dec 2019 at 15:39, Peter Bennett <pb.mythtv@gmail.com> wrote:
>
>
>
> On 12/9/19 9:22 PM, Aman Gupta wrote:
>
>
>
> On Mon, Dec 9, 2019 at 2:35 PM Peter Bennett <pb.mythtv@gmail.com> wrote:
>>
>> Hi Aman
>>
>> There is still the ongoing issue with decoding mpeg2 using mediacodec
>> through ffmpeg. The process hangs, and never gets any frames back.
>
>
> I have not experienced any such issue. You're not receiving even a single frame back?
>
> No frame is seen. This is only with fire stick 4k. It works fine on Nvidia Shield.
>
> Are you creating the decoder with a Surface or not?
>
> This is not using a surface, just decoding with ffmpeg into memory and rendering after that with OpenGL. Mark Kendall is working on direct rendering. I do not know if the same problem will happen there, as the direct rendering is not currently in a working state.
>>
>>
>>
>> As a separate project i have developed a pure android mythtv frontend
>> player, using java and the exoplayer library. It is working well and I
>> am surprised to find that it plays mpeg2 perfectly and also deinterlaces
>> it. Exoplayer uses pure mediacodec, there is no software video decoding.
>>
>> Whatever the problem is with mediacodec and fire stick 4K, evidently
>> there must be a way around it.
>>
>> If you need any more information please contact me.
>>
>> Regards
>> Peter
>
>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Mediacodec playback of mpeg2 on fire stick 4k [ In reply to ]
AFAIK, this can only be done via the JAVA MediaCodec API.

This is what gecko is using:
https://github.com/mozilla/gecko-dev/blob/master/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java

The particular code is this:
https://github.com/mozilla/gecko-dev/blob/master/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java#L72

This will enumerate the supported codec.

On Fri, 13 Dec 2019 at 19:49, Mark Kendall <mark.kendall@gmail.com> wrote:
>
> Aman
>
> On a slightly different note - can you tell me whether there is a way
> to detect in advance what codecs any given MediaCodec implementation
> actually supports?
>
> I like to do as many up front checks as possible - and MediaCodec is
> currently a bit of a black hole. Our code does fallback to software
> decoding but it is not very clean (as we have to wait for decoding to
> fail) and we lose a few frames as a result.
>
> Thanks and regards
> Mark
>
> On Wed, 11 Dec 2019 at 15:39, Peter Bennett <pb.mythtv@gmail.com> wrote:
> >
> >
> >
> > On 12/9/19 9:22 PM, Aman Gupta wrote:
> >
> >
> >
> > On Mon, Dec 9, 2019 at 2:35 PM Peter Bennett <pb.mythtv@gmail.com> wrote:
> >>
> >> Hi Aman
> >>
> >> There is still the ongoing issue with decoding mpeg2 using mediacodec
> >> through ffmpeg. The process hangs, and never gets any frames back.
> >
> >
> > I have not experienced any such issue. You're not receiving even a single frame back?
> >
> > No frame is seen. This is only with fire stick 4k. It works fine on Nvidia Shield.
> >
> > Are you creating the decoder with a Surface or not?
> >
> > This is not using a surface, just decoding with ffmpeg into memory and rendering after that with OpenGL. Mark Kendall is working on direct rendering. I do not know if the same problem will happen there, as the direct rendering is not currently in a working state.
> >>
> >>
> >>
> >> As a separate project i have developed a pure android mythtv frontend
> >> player, using java and the exoplayer library. It is working well and I
> >> am surprised to find that it plays mpeg2 perfectly and also deinterlaces
> >> it. Exoplayer uses pure mediacodec, there is no software video decoding.
> >>
> >> Whatever the problem is with mediacodec and fire stick 4K, evidently
> >> there must be a way around it.
> >>
> >> If you need any more information please contact me.
> >>
> >> Regards
> >> Peter
> >
> >
> > _______________________________________________
> > mythtv-dev mailing list
> > mythtv-dev@mythtv.org
> > http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> > http://wiki.mythtv.org/Mailing_List_etiquette
> > MythTV Forums: https://forum.mythtv.org
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev@mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org