[mythtv] Mediacodec problem with fire stick 4K

John Pilkington johnpilk222 at gmail.com
Fri Nov 23 23:18:04 UTC 2018


On 22/11/18 05:46, Aman Gupta wrote:
> 
> On Tue, Nov 20, 2018 at 2:32 PM Aman Gupta <aman at tmm1.net 
> <mailto:aman at tmm1.net>> wrote:
> 
> 
> 
>     On Tue, Nov 20, 2018 at 2:28 PM Peter Bennett <pb.mythtv at gmail.com
>     <mailto:pb.mythtv at gmail.com>> wrote:
> 
>         Hi Aman
> 
>         When running with mediacodec on the fire stick 4K, there is a
>         problem
>         with MPEG2. Perhaps the 4K does not support MPEG2 or the
>         interlacing is
>         causing a problem. What appears to happen is that we get the
>         situation
>         where we have done avcodec_send_packet until it returns
>         AVERROR(EAGAIN).
>         The avcodec_receive_frame also returns AVERROR(EAGAIN) and this
>         continues forever, we never get a frame out of it. With h264 it
>         works
>         fine. If there is no MPEG2 support, maybe we should get an error
>         return
>         or it should revert to software decoding. Is there anything
>         ffmpeg can
>         do to avoid this, or do I have something wrong in my code?
> 
> 
>     The hardware mpeg2 decoder on that device is extremely buggy.
> 
>     For some interlaced streams, it will generate flashing green output:
>     https://github.com/amzn/exoplayer-amazon-port/issues/58
> 
>     For videos where it works, the decoder will randomly lock up after
>     some time and stop accepting new packets and also stop returning new
>     frames (as you noticed).
> 
> 
> The green screen issue is definitely hardware specific, but this 
> freezing issue may actually be an ffmpeg bug.
> 
> I recall that I've seen the freeze happen on other FireOS devices, like 
> the older FireTV boxes.
> 
> Further, none of these devices (including the new 4K stick) seem to 
> reproduce the hang when using Exoplayer or VLC.

I got a 4K FireStick yesterday, and have VLC playing DVD-format stuff 
from my NAS.  It played fine for several minutes, until the picture 
froze and the sound played on...

John P

> 
> However I'm not sure what ffmpeg could do differently to avoid this 
> issue. The code in ffmpeg is already very similar to Exoplayer.
> 
> I've spent dozens of hours trying to debug this at various times this 
> year and sadly made no progress. It seems to happen quite regularly on 
> the 4K stick, which at least makes it easier to try out potential fixes.
> 
> If anyone wants to spend time on this I'm happy to advise, but I have 
> given up on trying to fix this myself.
> 
> Aman
> 
> 
>     These are issues in the underlying codec/hardware/OS and not
>     something ffmpeg can work-around.
> 
>     Aman
> 
> 
>         I have set ffmpeg debug logging and captured the log. That is
>         here ->
>         https://pastebin.com/ZF9JiMTX
>         The code where we process packets is here ->
>         https://github.com/MythTV/mythtv/blob/a1349d7f535dfcc5993a1f515e4ee2cb257e3aa6/mythtv/libs/libmythtv/avformatdecoder.cpp#L3686
> 
>         Peter




More information about the mythtv-dev mailing list