第一个切片(xxxx-0.ts)高概率缺编码信息
lystormenvoy opened this issue · 0 comments
lystormenvoy commented
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信息,导致播放异常
目前解决方案是先写死(因为都是h264+aac),不知道为什么acodec和vcodec会是0