Streampunk / beamcoder

Node.js native bindings to FFmpeg.
GNU General Public License v3.0
399 stars 76 forks source link

Error splitting the input into NAL units. #88

Open dharmik-dalwadi-seaflux opened 2 years ago

dharmik-dalwadi-seaflux commented 2 years ago

I am facing this error when decode the mkv file with h264 codec.

Error

[h264 @ 0x3c78200] No start code is found.
[h264 @ 0x3c78200] Error splitting the input into NAL units.

Reproduction Steps

MKV File which i'm using : https://github.com/aws/amazon-kinesis-video-streams-parser-library/blob/master/src/test/resources/output_get_media.mkv

const beamcoder = require('beamcoder');

async function run() {
    const demuxer = await beamcoder.demuxer('<video-file>.mkv');
    console.log(JSON.stringify(demuxer));
    const decoder = beamcoder.decoder({ name: 'h264' });

    let packet = {};
    for (let x = 0; x < 1000 && packet !== null; x++) {
        packet = await demuxer.read();
        if (packet && packet.stream_index === 0) {
            const data = await decoder.decode(packet);
                        console.log(data)
        }
    }
}
run();

Related

dharmik-dalwadi-seaflux commented 2 years ago

This issue has been fixed by providing the extradata into the decoder.

decoder.extradata = demuxer.streams[0].codecpar.extradata
vinnitu commented 9 months ago

what is it extradata?