[Bug]: MP4 File appears to have time duration 00:01 in video player
Version
2.6.0
Environment that reproduces the issue
Samsung Galaxy S23 - SM-S9111U1
RTMP/SRT/... Server
Not streaming
Audio configuration
default
Video configuration
HEVC / H.264
Is it reproducible in the demos application?
Yes
Reproduction steps
Settings | Endpoint | Type = "Write to a MP4 file" Start Live Record 10s of video Stop
Go to Gallery application, or other (Google Photos)
Expected result
video should be shown with a time of 0:10 (or however long you recorded it)
Actual result
video is shown to have time of 0:01
Additional context
Note that if you play the video, it plays all the way through. The content is all there.
Relevant logs output
No response
Hi,
The MP4 is not a strict MP4 but is a Fragmented MP4.
These players infers the duration from the moov box (1s is the duration of the first moov + mdat) but does not seem to read after.
Have you tested with VLC or other players?
Well, it is either the player does not properly read the info, either there is missing hint box in the MP4 generated by StreamPack. I will have a look on that when I have time 👍
It might be because tfra box entries time is not related to the moov mdhd box duration.
Bad news, I tested a mobile player with a progressive mp4 generated from ffmpeg and the duration was also 1s.
I guess mobile player are kind of lazy.
The easiest way to fix your issue is (from my opinion) to use the MediaMuxer directly. See https://developer.android.com/reference/android/media/MediaMuxer
On next version I plan to use the MediaMuxer for most file recording.
WIP in https://github.com/ThibaultBee/StreamPack/pull/123 (branch is not stable yet)
MP4 file will be generated by MediaMuxer since 3.0.0