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

Quicktime reports mp4 file as having double the time it actually has #347

Open
bobbydigitales opened this issue Jun 28, 2023 · 0 comments
Open

Comments

@bobbydigitales
Copy link

Hi!

I'm using the webCodecs API to create an mp4 file.

My encoder config looks like this:

    const config = {
        codec: "avc1.640029",
        width: width,
        height: height,
        framerate: 60,
        bitrate: 10e6,
        // hardwareAcceleration:"prefer-hardware"
    };

I add my video track like this:

 trackID = mp4.addTrack( {
                    timescale: timescale,
                    width: width,
                    height: height,
                    // nb_samples: 60 * duration,
                    media_duration: duration * fps * frameDuration,
                    avcDecoderConfigRecord: config.decoderConfig.description
                } );

And I add samples like this:

  mp4.addSample(trackID, uint8, {
                dts: chunk.timestamp,
                cts: chunk.timestamp,
                duration: frameDuration,
                is_sync: chunk.type === 'key'
            });

I've attached the resulting file which reports as 8 seconds in Quicktime and Safari. I also noticed that the resulting file cannot be uploaded to Twitter (fails to process) and it fails to preview in Slack.

Timestamps and the number of frames look correct when inspecting using https://gpac.github.io/mp4box.js/test/filereader.html

Any help would be appreciated!

dbb_Tue.Jun.27.2023.18_43_47.GMT-0700.Pacific.Daylight.Time.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant