New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CaptureFromTexture .MP4 files do not play in Chrome/Edge browers but do via VLC or Media Player #260
Comments
Also tried the HEVC codec and setting the codec tags in HTML5 video, just nothing in Chrome or Edge, Firefox works tho. |
... found the bug, audio is mono in the .MP4 file and Metadata says stereo and missing ACC ID_END, so reopening. In the media-internals tab you will get the breakdown of last played, and the audio warning. info: Selected D3D11VideoDecoder for video decoding, config: codec: h264, profile: h264 high, level: not available, alpha_mode: is_opaque, coded size: [1280,720], visible rect: [0,0,1280,720], natural size: [1280,720], has extra data: true, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:SMPTE170M, matrix:BT709, range:LIMITED} And then the error |
If you download the .mp4 shared to a windows PC and you open it with VLC you will see the Metadata says Stereo (VLC bug). This is clearly a bug, either: |
More information, if you use ffmpeg -i broken.mp4 fixed.mp4 you get a working file, here is the link: During the ffmpeg process there is definatly errors in the source .mp4 created by CaptureFromTexture, so this is 100% a bug. [aac @ 000002179eb3e340] Input buffer exhausted before END element found |
I did some more testing, this time using HVEC and no pausing, here are the two files, one direct from device using CaptureFromTexture and one copied using ffmpeg, using this: Stream copy is a mode selected by supplying the copy parameter to the -codec option. It makes ffmpeg omit the decoding and encoding step for the specified stream, so it does only demuxing and muxing. It is useful for changing the container format or modifying container-level metadata. Thus all I did is correct the malformed .MP4 container. You have this error in the source: And on the copied file where the structure is corrected: Files here: Using chrome://media-internals/ to debug Original, fails on broken ACC audio metadata:
Copied version, working:
|
Duplicate of #243 |
Hi,
The issue is that metadata of the file created by the plugin, it is missing the END tag, this is not an Android device problem.
If you rebuild the container it fixes the tag.
Your .MP4 file is missing the end tag, I have another plugin that creates a correct tag but it has poor performance.
This is a bug, not an Android OS problem.
Sent from Android device
On 26 Feb 2023 11:16, Morris Butler ***@***.***> wrote:
Duplicate of #243<#243>
—
Reply to this email directly, view it on GitHub<#260 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AR2MTXJYS7CBQGKVTENWL2TWZMNNHANCNFSM6AAAAAAVHY55WM>.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
@MorrisRH I'm not sure how you wrote the plugin, I'm assuming you are calling some Java code for Android and using known MediaMuxer. ie. https://developer.android.com/reference/android/media/MediaMuxer There is something called mEncoder.signalEndOfInputStream(); Can you confirm that you guys are implementing this? |
We're using the NDK Media module for the video encoding and can confirm that EOS is being handled correctly. |
Hmmm, this is really odd, because I'm using both NatCorder and AVPro, NatCorder changed their model and no longer do a standalone recorder so we had to change, their .MP4 container is correct, the AVPro one is malformed, on same device. Maybe the way you rewrite the moov causes it? I know its purely structural because demuxing and remuxing fixed the error. Stumped, can be anything from presentationTimes being off to the way its written, do you have any way to validate or remux the file? This is really a big issue especially with the amount of AR/VR devices running Android not being able to write/save a correct MP4 container. |
I'll see when I get some time, maybe test https://github.com/arthenica/ffmpeg-kit and write a demux/remux workaraound, until there's a fix. Based on this: https://github.com/arthenica/ffmpeg-kit/wiki/Using-FFmpegKit-in-Unity Althought not for this version of ffmpeg, here is a guide on the previous version. https://sourceexample.com/en/671cf50fddfec13eb5e1/ |
I've managed to track this down. It was caused by differences between how the AMediaMuxer on different devices handle codec configuration packets. Samsung devices always discard the packet whereas the Google Pixel 4 writes it out. The fix will make it into the next release. |
The latest version has been released. Please let us know if it has not fixed the issue for you. |
@Chris-RH Can confirm that the issue has been resolved and videos are now playable in Chrome browers. |
When recording using CaptureFromTexture the .mp4 file is playable using a Windows media player like VLC etc. However the video will not play in Chrome.
To Reproduce
Download this to desktop and open with VLC or Media player:
https://storage.googleapis.com/notifiesu/test/8c62ad77-0bd4-4647-8ab3-0cfac68ad069v1.mp4
Open same link in Chrome Browser and try to play.
The text was updated successfully, but these errors were encountered: