Closed NK-Studio closed 1 week ago
It plays correctly on Exo Player, but does not play on Media Player. I disabled the Auto Graphic option and conducted the test with OpenGLES3. The AVPro demo video plays correctly, so the issue cannot be reproduced with the demo video. The test was conducted on Samsung Galaxy S10, S21, and S22+.
Is there a reason that you specifically want to use Android Mediaplayer rather than Exoplayer?
I've managed to play it on my S9 in the mediaplayer demo scene using Vulkan+Exoplayer, Vulkan+Mediaplayer, OpenGLES+Mediaplayer and OpenGLES+Exoplayer.
The Demo sample works fine without any issues. However, as described in the "Describe the issue" section, when trying to load and play this video via URL: https://mhnispjsagtzdbgazzsu.supabase.co/storage/v1/object/public/avatars/Nupy/test.mp4, it does not play.
The reason I am specifically trying to use Media Player on the Android platform is that in a previous report I made, the issue of audio distortion when alternating between videos with 44Hz and 48Hz audio was resolved. While ExoPlayer still encounters audio distortion issues, Media Player plays the audio correctly but does not play the video. Therefore, I am attempting to resolve this issue using Media Player.
Can you provide a full, unfiltered logcat in txt format for when it doesn't play please?
Hi @NK-Studio
I've looked at your video and I can see two problems:
You can re-encode your video using the following ffmpeg commands
ffmpeg -i test.mp4 -c copy test.mkv
ffmpeg -i test.mkv -c copy -movflags +faststart fixed.mp4
The first line just copies your file into an mkv container, and the second line creates a new mp4 from the mkv. This has the effect of interleaving the audio and video tracks without requiring a re-encode. The second line also enables the faststart option which moves the MOOV atom to the start of the file (essential for playing files via http).
I just learned about the faststart flag in MP4s, and after applying it, the loading speed has significantly improved! The AVPro team is amazing for sharing this information. Top-notch!
You mentioned that the video and audio tracks are not interleaved. Could you explain in detail how I can verify this?
I use mp4info from the bento4 tools, available here.
Using it like this:
mp4info --verbose --show-layout test.mp4
Generates the following output:
From this you can see that the audio track (marked with [A]) follows the video track ([V]).
When the file is interleaved (using the ffmpeg commands provided previously) the output will look like the following:
Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE
Describe the issue I am currently trying to play a video using the Android MediaPlayer method in Unity. In this case, I have disabled Auto Graphic API and only added OpenGL3 for Android.
I am trying to play this video(https://mhnispjsagtzdbgazzsu.supabase.co/storage/v1/object/public/avatars/Nupy/test.mp4), but only the audio plays and the video does not.
Your Setup (please complete the following information):
To Reproduce
Logs If applicable, add error logs to help explain your problem.
Screenshots If applicable, add screenshots to help explain your problem.
Videos If applicable, add a copy of your video or the URL
Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE
Instead email the link to us unitysupport@renderheads.com