pachli-android icon indicating copy to clipboard operation
pachli-android copied to clipboard

Unsupported Video Codec?

Open bee8bit opened this issue 1 year ago • 7 comments

Describe the bug Repeatedly stumbled across toots with a video that won't play In the last few days. Instead a very technical error message appears:

Wiedergabe fehlgeschlagen: Decoder init failed: c2.qti.avc.decoder, Format(1, null, null, video/ avc, avc1.4D0033, -1, null, [2232, 1340, 56.39198, ColorInfo(BT709, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1])

”Wiedergabe fehlgeschlagen“ is ”Playback failed in German.

I cannot tell if users have started posting videos in a new and unsupported format, if it is a bug in my version of Pachli, or if it is the fault of my new device (Moto g84 5G, Android 14).

To Reproduce Steps to reproduce the behavior:

  1. Open https://front-end.social/@chriscoyier/113439004295620843 in Pachli
  2. Click on the video
  3. See an error message instead of a video

Expected behavior The video plays (or, if that's beyond possible, I can find a helpful explanation. That is, for non-developers: File is corrupted; Codec is missing. See here to install; Android 1138 required; Device with special hardware required; ...)

Versions Pachli Current 2.8.3+adc7060b

Device: motorola moto g84 5G Android-Version: 14 SDK-Level: 34

Account: @[email protected] Version: 4.3.1

Affirmation I have checked other issues for this project (open and closed) and I cannot find one that matches the problem I am reporting.

bee8bit avatar Nov 08 '24 07:11 bee8bit

Thanks for the report.

Note to self: ViewVideoFragment has this:

            override fun onPlayerError(error: PlaybackException) {
                val message = getString(
                    R.string.error_media_playback,
                    error.cause?.message ?: error.message,
                )
                Snackbar.make(binding.root, message, Snackbar.LENGTH_INDEFINITE)
                    .setAction(app.pachli.core.ui.R.string.action_retry) { player?.prepare() }
                    .show()
            }

which preferentially shows the inner error message from cause. Changing that to just use error.message might provide a better error, which is worth trying.

nikclayton avatar Nov 12 '24 10:11 nikclayton

Today's Pachli Current is going to include a change that prefers the "higher level" error message from the video player (if it exists). I'd be grateful if you could let me know if that provides better / more actionable information.

nikclayton avatar Nov 25 '24 12:11 nikclayton

Thank you for the effort. The message is different now:

Wiedergabe fehlgeschlagen: MediaCodec VideoRenderer error, index=0, format-Format(1, null, null, video/ avc, avc1.4D0033, -1, null, [2232, 1340, 56.39198, ColorInfo(BT709, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1]), format_su...

Well, that is still very technical. And now the message is cropped. The last word might be something readable but right now it is not useful yet.

Idea: What about a simple message like "Playback failed" (localized), followed by a "details" button/link/collapse_toggle that reveals the full details. I suppose the exceptions themselves are too unpredictable or complex so it would be out of scope to translate them into anything understandable. We're talking about a mastodon client, not a video authoring tool.

bee8bit avatar Nov 26 '24 09:11 bee8bit

I've faced with some posts with videos that can't be played. Pachli gives the following error:

Image

Link to post:

https://fosstodon.org/@stovis/114211103706705602

See attached adb log:

fosstodon.log

However, other posts aren't affected. For example:

https://stefanbohacek.online/@trains/114218243698043458

I've tried from different servers within Pachli but the error persists. If I download video from Pachli, I can play it on the device. I can also play it by opening the post in the android web browser.

I've noticed there are a few differences between both example videos, but don't know if that causes the issue. I wonder if it could be related to the resolution of video vs device, as high resolution videos can't be played so far. I could not find any high resolution video that works. I'll keep an eye on this problem and bookmark posts that fail. Just in case it helps, here are the media info I get from both videos:

fosstodon-info.txt stefanbohacek-info.txt

Open https://front-end.social/@chriscoyier/113439004295620843 in Pachli

By the way, I get the same error by trying that post.

Other non-working examples

1

Image

https://social.hardlimit.com/@pos_yo/114041468280235743

hardlimit.log

hardlimit-info.txt

2

Image

https://mastodon.social/@atareao/112530916701915838

mastodon.log

mastodon-info.txt

Device and software information Motorola Moto E2 Pachli 2.10.1 Android 10

jumase avatar Mar 25 '25 03:03 jumase

@jumase : I think these might be device / Android version issues, as those play OK in Pachli on my Pixel 4a 5G (Android 14).

Because of that it's tricky for me to turn this in to a bug report for the androidx.media3 group, but you should be able to. To do that you need to:

  1. Clone and import the project at https://github.com/androidx/media

  2. Edit demo/assets/media.exolist.json. The format is self-explanatory. For example, to add the first video that failed I added:

      {
        "name": "Mastodon samples",
        "samples": [
          {
            "name": "@stovis example",
            "uri": "https://cdn.fosstodon.org/media_attachments/files/114/211/099/336/417/018/original/1a6da5c3bbddf138.mp4"
          }
        ]
      },
    

    as the first entry.

  3. From Run Configurations select demo, then build and launch it on your device.

  4. Select the videos that should fail, and try and play them.

  5. File a bug report using https://github.com/androidx/media/issues/new?template=bug.yml.

https://github.com/androidx/media/issues/524 is an example of a report I've filed previously.

If you get to step 4 and the videos play OK in the demo app let me know, as that would point back to a Pachli issue.

nikclayton avatar Mar 26 '25 12:03 nikclayton

I think these might be device / Android version issues, as those play OK in Pachli on my Pixel 4a 5G (Android 14).

Good to know then. 🙂 I can still download videos to watch them locally (great feature). Besides, it's a great feature to avoid playback loop and so re-downloading of big videos.

Thanks for all the information. I could manage to build the demo but could not play any of the videos. I've just filed a bug report at https://github.com/androidx/media/issues/2290

jumase avatar Mar 29 '25 23:03 jumase

Apparently, the issue is that my device doesn't have hardware decoding support, although there is software decoding. However, ExoPlayer (or my device) fails to select the software decoding, I could not fully understand why. An ExoPlayer developer suggested implementing a workaround to remove the hardware decoder from the options, and provided some guidance on this. I'm not sure if that should/could be implemented on Pachli.

As I mentioned on the other issue, I can usually play those videos with VLC after downloading. So having the download button is great for my usage. One thing that could be done in this regard is providing an option to download videos directly on long-pressing, though I'm not sure how difficult or reliable this could be. It would save only one click but the main advantage is that it would avoid the pre-downloading that happens between I first tap on the video until I click download — I have disabled "Download media previews" in settings. Or even better, extract/export media from cache; is that possible (to avoid double downloading)?

jumase avatar Sep 20 '25 20:09 jumase