nyanmisaka / ffmpeg-rockchip

FFmpeg with async and zero-copy Rockchip MPP & RGA support
Other
480 stars 69 forks source link

Stream down Error submitting packet to decoder #117

Open YannickPerret opened 4 days ago

YannickPerret commented 4 days ago

Hello, I've launched two streams on my rock5b+:

Both had the stream_loop parameter set to -1.

It's my stream that has the single stream that has crashed

When the stream was at around 6:8, I received this message telling me to report the bug:

[23:25:52.748] INFO (3401): [vist#0:0/vp9 @ 0xaaaaea3155a0] Error submitting packet to decoder: Generic error in an external library

[23:25:52.945] INFO (3401):     Last message repeated 84 times
frame=1309933 fps= 60 q=-0.0 size=15507658kB time=06:03:55.34 bitrate=5818.0kbits/s speed=   1x    
[23:25:52.945] INFO (3401): [vist#0:0/vp9 @ 0xaaaaea3155a0] Error submitting packet to decoder: Generic error in an external library

[23:25:53.139] INFO (3401):     Last message repeated 10 times
[vist#0:0/vp9 @ 0xaaaaea3155a0] A decoder returned an unexpected error code. This is a bug, please report it.
[vist#0:0/vp9 @ 0xaaaaea3155a0] Error processing packet in decoder: Internal bug, should not have happened
[vist#0:0/vp9 @ 0xaaaaea3155a0] Decoder thread returned error: Internal bug, should not have happened

[23:25:53.159] INFO (3401): frame=2021407 fps= 60 q=-0.0 size=N/A time=09:21:30.13 bitrate=N/A speed=   1x    
[23:25:53.455] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:55.85 bitrate=5817.9kbits/s speed=   1x    
[23:25:53.473] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:25:53.663] INFO (3401):     Last message repeated 15 times
frame=2021411 fps= 60 q=-0.0 size=N/A time=09:21:32.09 bitrate=N/A speed=   1x    
[23:25:53.680] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:25:53.956] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:56.36 bitrate=5817.8kbits/s speed=   1x    
[23:25:54.165] INFO (3401):     Last message repeated 29 times
frame=2021411 fps= 60 q=-0.0 size=N/A time=09:21:32.60 bitrate=N/A speed=   1x    
[23:25:54.180] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:25:54.467] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:56.88 bitrate=5817.6kbits/s speed=   1x    
[23:25:54.675] INFO (3401):     Last message repeated 29 times
frame=2021411 fps= 60 q=-0.0 size=N/A time=09:21:33.12 bitrate=N/A speed=   1x    
[23:25:54.681] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:25:54.972] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:57.39 bitrate=5817.5kbits/s speed=   1x    
[23:25:55.175] INFO (3401):     Last message repeated 29 times
frame=2021411 fps= 60 q=-0.0 size=N/A time=09:21:33.63 bitrate=N/A speed=   1x    
[23:25:55.181] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:25:55.474] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:57.88 bitrate=5817.4kbits/s speed=   1x    
[23:25:55.676] INFO (3401):     Last message repeated 29 times
frame=2021411 fps= 60 q=-0.0 size=N/A time=09:21:34.12 bitrate=N/A speed=   1x    
[23:25:55.681] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:25:55.972] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:58.37 bitrate=5817.2kbits/s speed=   1x    
[23:25:56.182] INFO (3401):     Last message repeated 30 times
frame=2021411 fps= 60 q=-0.0 size=N/A time=09:21:34.63 bitrate=N/A speed=   1x    
[23:25:56.200] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:25:56.486] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:58.90 bitrate=5817.1kbits/s speed=   1x    
[23:25:56.695] INFO (3401):     Last message repeated 29 times
frame=2021411 fps= 60 q=-0.0 size=N/A time=09:21:35.14 bitrate=N/A speed=   1x    
[23:25:56.700] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:25:56.857] INFO (3401):     Last message repeated 8 times
[out_0_0 @ 0xaaab02f953a0] 100 buffers queued in out_0_0, something may be wrong.

[23:25:56.987] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:59.39 bitrate=5817.0kbits/s speed=   1x    
[23:25:57.491] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:03:59.91 bitrate=5816.8kbits/s speed=   1x    
[23:25:57.989] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:04:00.40 bitrate=5816.7kbits/s speed=   1x    
[23:25:58.245] INFO (3401): frame=2021721 fps= 60 q=-0.0 size=N/A time=09:21:35.33 bitrate=N/A speed=   1x    
[23:25:58.505] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:04:00.91 bitrate=5816.6kbits/s speed=   1x    
[23:25:58.776] INFO (3401): frame=2021731 fps= 60 q=-0.0 size=N/A time=09:21:35.74 bitrate=N/A speed=   1x    
[23:25:59.009] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:04:01.42 bitrate=5816.4kbits/s speed=   1x    
[23:25:59.346] INFO (3401): frame=2021731 fps= 60 q=-0.0 size=N/A time=09:21:36.17 bitrate=N/A speed=   1x    
[23:25:59.523] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507679kB time=06:04:01.91 bitrate=5816.3kbits/s speed=   1x    
[23:25:59.791] INFO (3401): frame=2021731 fps= 60 q=-0.0 size=N/A time=09:21:36.53 bitrate=N/A speed=   1x    
[23:26:00.027] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507682kB time=06:04:02.44 bitrate=5816.1kbits/s speed=   1x    
[23:26:00.351] INFO (3401): frame=2021731 fps= 60 q=-0.0 size=N/A time=09:21:36.81 bitrate=N/A speed=   1x    
[23:26:00.540] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507691kB time=06:04:02.93 bitrate=5816.0kbits/s speed=   1x    
[23:26:00.849] INFO (3401): frame=2021731 fps= 60 q=-0.0 size=N/A time=09:21:37.11 bitrate=N/A speed=   1x    
[23:26:01.047] INFO (3401): frame=1309935 fps= 60 q=-0.0 size=15507701kB time=06:04:03.47 bitrate=5815.9kbits/s speed=   1x    
[23:26:01.103] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:26:01.356] INFO (3401):     Last message repeated 9 times
frame=2021731 fps= 60 q=-0.0 size=N/A time=09:21:37.40 bitrate=N/A speed=   1x    
[23:26:01.356] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Error submitting packet to decoder: Generic error in an external library

[23:26:01.418] INFO (3401):     Last message repeated 1 times
[vist#0:0/vp9 @ 0xaaab02ea25a0] A decoder returned an unexpected error code. This is a bug, please report it.
[vist#0:0/vp9 @ 0xaaab02ea25a0] Error processing packet in decoder: Internal bug, should not have happened

[23:26:01.418] INFO (3401): [vist#0:0/vp9 @ 0xaaab02ea25a0] Decoder thread returned error: Internal bug, should not have happened

My command :

const inputParameters = [
      '-re',
      '-hwaccel', 'rkmpp',
      '-protocol_whitelist', 'file,concat,http,https,tcp,tls,crypto',
    ];

    if (this.loop) {
      inputParameters.push('-stream_loop', '-1');
    }

    inputParameters.push('-f', 'concat', '-safe', '0', '-i', `concat:${this.timelinePath}`);

    let filterComplex: string[] = [];

    if (this.showWatermark) {
      const watermarkPath = app.publicPath('watermark/watermark.webp');
      inputParameters.push('-i', watermarkPath);
      filterComplex.push(`[0:v][1:v]overlay=(main_w-overlay_w)/2:10[fv]`);
    } else {
      filterComplex.push(`[0:v]fps=fps=${this.fps}[fv]`);
    }

    if (this.enableBrowser) {
      await this.startBrowserCapture();
      inputParameters.push('-i', SCREENSHOT_FIFO);
      filterComplex.push(
        `[1:v]colorkey=0xFFFFFF:0.1:0.2,fps=fps=24}[ckout];`,
        `[fv][ckout]overlay=0:0,fps=fps=${this.fps}[v1]`
      );
    }

    const encodingParameters = [
      '-r', this.fps.toString(),
      '-filter_complex', filterComplex.join(''),
      '-map', '[v1]',
      '-map', '0:a?',
      '-s', this.resolution,
      '-c:a', 'aac', '-c:v', 'h264_rkmpp',
      '-b:v', this.bitrate,
      '-maxrate', this.bitrate,
      '-bufsize', `${Number.parseInt(this.bitrate) * 2}k`,
      '-flags', 'low_delay'
    ];

    if (this.channels.length === 1) {
      const channel = this.channels[0];
      const baseUrl = BASE_URLS[channel.type];
      const outputUrl = `${baseUrl}/${encryption.decrypt(channel.streamKey)}`;
      encodingParameters.push('-f', 'flv', outputUrl);
    } else {
      const teeOutput = this.channels.map(channel => {
        const baseUrl = BASE_URLS[channel.type];
        const outputUrl = `${baseUrl}/${encryption.decrypt(channel.streamKey)}`;
        return `[f=flv]${outputUrl}`;
      }).join('|');
      encodingParameters.push('-f', 'tee', teeOutput);
    }

Do I need to do anything to stop it happening again?

nyanmisaka commented 3 days ago

Please provide a video file that can be used to reproduce the problem and a complete ffmpeg command. I don't have your environment.

Also make sure you build using the mpp repo mentioned in the Wiki, not the outdated mpp library provided by the SBC vendor.