问题
在对接某几款海康ipc时,通过ffmpeg - rstp … -f flv rtmp://…. 时会导致ffmpeg 命令失败,报错如下
1 | [flv @ 0x940bc0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly |
解决
这个问题在ffmpeg 4.2.2 版本中正常, 比对ffmpeg4.2.2 和 ffmpeg 4.3.2 的flvenc.c 代码
删除 flv_write_packet 函数中 如下代码
1 | if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) { |