rockchip-linux / mpp

Media Process Platform (MPP) module
596 stars 172 forks source link

使用mpi_dec_test进行h264解码遇到错误 #567

Closed Kevin111369 closed 7 months ago

Kevin111369 commented 7 months ago

在使用mpi_dec_test进行解码的时候遇到以下错误:

mpp[44892]: mpi_dec_utils: input file input.h264 size 9502081
mpp[44892]: mpi_dec_utils: cmd parse result:
mpp[44892]: mpi_dec_utils: input  file name: input.h264
mpp[44892]: mpi_dec_utils: output file name: 
mpp[44892]: mpi_dec_utils: width      :    0
mpp[44892]: mpi_dec_utils: height     :    0
mpp[44892]: mpi_dec_utils: type       :    7
mpp[44892]: mpi_dec_utils: max frames :    0
mpp[44892]: mpi_dec_test: mpi_dec_test start
mpp[44892]: mpi_dec_test: 0x112e35a0 mpi_dec_test decoder test start w 0 h 0 type 7
mpp[44892]: h264d_sei: seq_parameter_set_id 0 may be invalid
mpp[44892]: h264d_sei: seq_parameter_set_id 0 may be invalid
mpp[44892]: h264d_sei: seq_parameter_set_id 0 may be invalid
mpp[44892]: h264d_sei: seq_parameter_set_id 0 may be invalid
mpp[44892]: h264d_sei: seq_parameter_set_id 0 may be invalid

我执行的命令为:

mpi_dec_test -t 7 -i input.h264
HermanChen commented 7 months ago

把码流用ffmpeg解码看看是不是正常,看 log 是少了 sps

Kevin111369 commented 7 months ago

@HermanChen 这个测试文件是我使用ffmpeg保存的rtsp码流,使用ffmpeg解码这个文件也提示缺少sps。但是这个rtsp码流我使用ffmpeg可以正常保存,使用ffplay可以正常播放,为什么copy下来的裸流会缺少sps呢?

HermanChen commented 7 months ago

要加 -bsf h264_mp4toannexb

Kevin111369 commented 7 months ago

要加 -bsf h264_mp4toannexb

添加-bsf h264_mp4toannexb之后码流格式对了,使用ffmpeg copy的码流可以正常解码,但是实时解码的时候get frame为NULL,打印的信息如下:

[dec_simple]-145: av_packet->data:0xe4180a0
[dec_simple]-146: av_packet->size:1441
mpp[5684]: mpi: mpi_decode_put_packet enter ctx 0xe468be0 packet 0xe468848
mpp[5684]: mpi: mpi_decode_put_packet leave ctx 0xe468be0 ret 0
mpp[5684]: mpi: mpi_decode_get_frame enter ctx 0xe468be0 frame 0x7fc23e3e78
mpp[5684]: mpi: mpi_decode_get_frame leave ctx 0xe468be0 ret 0
[dec_simple]-349: 0xe468be0 get frame is null
HermanChen commented 7 months ago

多送几帧,解码器并不是一进一出的,还要把 split flag 关掉

Kevin111369 commented 7 months ago

多送几帧,解码器并不是一进一出的,还要把 split flag 关掉

我更换了RTSP推流服务器之后可以成功解码了,谢谢你的回答