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

第一个切片(xxxx-0.ts)高概率缺编码信息 #107

Open
lystormenvoy opened this issue Mar 19, 2024 · 0 comments
Open

第一个切片(xxxx-0.ts)高概率缺编码信息 #107

lystormenvoy opened this issue Mar 19, 2024 · 0 comments

Comments

@lystormenvoy
Copy link

2024/03/19 14:36:51 [error] 25#25: *14905 AVALog rtmp: gen_pmt| 000 video codec is (0), client: 192.168.4.164, server: 0.0.0.0:1935, session: 000000000401A8D0, stream: default/hls/ava_4028a4998dd56978018df8bdc3bb13c0_TP
2024/03/19 14:36:51 [error] 25#25: *14905 AVALog rtmp: gen_pmt| vpid = -1 (-1), client: 192.168.4.164, server: 0.0.0.0:1935, session: 000000000401A8D0, stream: default/hls/ava_4028a4998dd56978018df8bdc3bb13c0_TP

有时会是无法识别audio codec

对应代码是

if (vcodec == 0) {
        // ignore
    } else if (vcodec ==  NGX_RTMP_VIDEO_H264) {
        vpid = NGX_RTMP_MPEGTS_PID_H264;
    } else if (vcodec == NGX_RTMP_HEVC_CODEC_ID) {
        vpid = NGX_RTMP_MPEGTS_PID_H265;
    } else if (log) {
        ngx_log_error(NGX_LOG_ERR, log, 0,
            "rtmp: gen_pmt| unknown video codec (%d)", vcodec);
    }

    switch (acodec) {
        case 0: //ignore
        break;

        case NGX_RTMP_AUDIO_MP3:
            apid = NGX_RTMP_MPEGTS_PID_MP3;
        break;

        case NGX_RTMP_AUDIO_AAC:
            apid = NGX_RTMP_MPEGTS_PID_AAC;
        break;

        default:
            if (log) {
                ngx_log_error(NGX_LOG_ERR, log, 0,
                    "rtmp: gen_pmt| unknown video codec (%d)", vcodec);
            }
    }

这里vcodec和acodec会=0,所以生产的切片pmt里缺少音频或视频层pid信息,导致播放异常
image

目前解决方案是先写死(因为都是h264+aac),不知道为什么acodec和vcodec会是0

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