Skip to content

Mp4 muxer broken - missing h264 extradata (AVCC) #35

Description

@jpietek

I'm struggling to get the mp4 muxer output working on Windows10 default video stack, thus Adobe Premiere project bin (on third party players like VLC or Chrome it's playable). The video stream is not recognized at all, no metadata, nothing. Audio is fine.

The muxer is set up similarly as in the mp4 example:

        let vstr = this.mux.newStream({
            name: 'h264',
            encoderName: 'libx264',
            time_base: [1, 90000],
            interleaved: true,
            sample_aspect_ratio: [1, 1],
        });

        Object.assign(vstr.codecpar, {
            width: this.clip.dst_probe.width,
            height: this.clip.dst_probe.height,
            format: 'yuv420p',
            color_space: 'bt709',
            sample_aspect_ratio: [1, 1]
        });

MP4Box -info output, beamcoder muxer:

[iso file] Box "avcC" size 8 invalid (read 17
(...)
Track # 1 Info - TrackID 1 - TimeScale 90000 - Media Duration 00:00:00.840
Track has 2 edit lists: track duration is 00:00:00.920
Media Info: Language "und (und)" - Type "vide:avc1" - 21 samples
Visual Track layout: x=0 y=0 width=1920 height=1080
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1920 x 1080
        AVC Info: 1 SPS - 0 PPS - Profile Unknown @ Level 1.6
        NAL Unit length bits: 8
[AVC/HEVC] Not enough bits in bitstream !!
[AVC/HEVC] Not enough bits in bitstream !!
[AVC/HEVC] Not enough bits in bitstream !!
[AVC/HEVC] Not enough bits in bitstream !!
[AVC/HEVC] Not enough bits in bitstream !!
[AVC/HEVC] Not enough bits in bitstream !!
[AVC/HEVC] Not enough bits in bitstream !!
        SPS#1 hash: 2C6E8EB7626F90A283FDE68C6FBE67EE19A48284
Self-synchronized
        RFC6381 Codec Parameters: avc1.000010
        Average GOP length: 21 samples

I've finally figured out that the problem is with missing h264 extradata (AVCC) in stream->codecpar. The source of the video is MPEGTS, which does not provide it (null in js object). I guess the ffmpeg automaticaly adds a proper bitstream filter while transmuxing ts->mp4 (?).

Any idea how to achieve a similar to ffmpeg behaviour with beamcoder? I've tried generating the AVCC bytes on my own, but got it a bit wrong, having some missing frames in the video. Would be easier to get it done with libav itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions