popcorn-official / popcorn-android

Popcorn Time is a multi-platform, free software BitTorrent client that includes an integrated media player ( Android / AndroidTV ) A Butter-Project Fork
https://popcorn-time.site
Other
1.26k stars 278 forks source link

More info about the garbled green screen during video playback #340

Closed Rhiannon81 closed 5 years ago

Rhiannon81 commented 6 years ago

Many users have reported playback on Android is "broken", all they see on screen is a garbled green image. This happens mainly for two reasons:

  1. Failed initialization of hardware video decoder
  2. "Less than ideal" defaults in LibVLC/avcodec for software only decoding, specifically: --avcodec-threads is set to 1. --avcodec-skip-frame is set to 3.

Setting a sane value for threads, and skip-frame to 0, fixes the image. As for deblocking/postprocessing, currently the parameters value are set automatically based on cpu performance. but in case that doesn't work out and the playback is too slow, one could set --avcodec-skiploopfilter and --avcodec-skipidct to 4. Additionally, set --avcodec-fast.

With these parameters, a dual core Cortex A9 device can play 720p with some hiccups in the most complex/fast scenes.

If you think this deserves a pull request, I added all these options in the preferences menu (TV version untested as I don't have a compatible device).

Now I'd like to understand why hardware decoding is failing, but I need some clarifications or documentation about some other stuff, as I am not a developer and I know nothing about ARM or Android.

As I found out, the VPU (the video decoder) is a separate chip from the GPU. This is not clear to many people; in fact I was a bit lost on the reason why my two devices, both with Mali 400 GPU, were behaving differently (green garbled mess vs. perfect playback).

The problematic device has an AMLogic VPU and is running stock image, Android 4.2.2. The other device is a Samsung Galaxy S2 (i9100) with the latest LineageOS 14.1 nightly.

On the AMLogic device I tried forcing --codec and --vout but I'm not clear on what vout modules are actually enabled in the LibVLC shipping with popcorn-android, or what is supported on Android 4.2.

When selecting --codec iomx LibVLC seems to find it before falling back to avcodec because of vout failing. Mediacodec is Android 5.0+ only, right? Vout is supposed to be iomx too, right? Or maybe surface? I read something about tunneled surface playback but I can't find definitive documentation about what version of Android supports surface, what the module is called in LibVLC, and whether it is enabled. Tunneled surface should be available with iomx, but I'm not really sure. It is available with mediacodec though (so Android 5.0+ only).

I need to run some more tests. If anybody has any ideas or useful documentation please let me know.

imurreflection commented 6 years ago

Hey mate, can you advise how can I change the codec information as advised by you for my android version. Is it possible using APK editor. If yes, please advise. I want to use it on My MITV 4 55 inch version running Android 6