Skip to content
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

[Bug]: MP4 File appears to have time duration 00:01 in video player #108

Open
cdiddy77 opened this issue Feb 19, 2024 · 4 comments
Open
Labels
bug Something isn't working
Milestone

Comments

@cdiddy77
Copy link

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

@cdiddy77 cdiddy77 added the bug Something isn't working label Feb 19, 2024
@ThibaultBee
Copy link
Owner

ThibaultBee commented Feb 19, 2024

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 👍

@ThibaultBee
Copy link
Owner

It might be because tfra box entries time is not related to the moov mdhd box duration.

@ThibaultBee
Copy link
Owner

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.

@ThibaultBee ThibaultBee added this to the 3.0.0 milestone Jun 12, 2024
@ThibaultBee
Copy link
Owner

WIP in #123 (branch is not stable yet)
MP4 file will be generated by MediaMuxer since 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants