[FFmpeg-devel] [RFC] Error handing with CBS

Zhao Zhili quinkblack at foxmail.com
Fri May 23 06:44:26 EEST 2025


I have created a ticket on trac and uploaded a sample.

https://trac.ffmpeg.org/ticket/11603

The issue is CBS can detect invalid data in the bitstream, and report error.
How to handle these error is a problem.

With a single error in SEI, it can break the decoding/transcoding process.

ffmpeg -bsf:v h264_metadata -i input.mp4 -f null -

[h264_metadata @ 0x60000392c0f0] Invalid SEI user data unregistered payload.
[h264_metadata @ 0x60000392c0f0] Failed to read unit 0 (type 6).
[h264_metadata @ 0x60000392c0f0] Failed to read access unit from packet.
[vist#0:0/h264 @ 0x14c704ba0] Error applying bitstream filters to a packet: Invalid data found when processing input
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x14c6062c0] Task finished with error code: -1094995529 (Invalid data found when processing input)
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x14c6062c0] Terminating thread with return code -1094995529 (Invalid data found when processing input)

Part of the problem is ffmpeg_demux.c doesn’t respect exit_on_error with
bsf error.

Another problem is CBS drops whole packet with a single error in SEI, and
the user of CBS doesn’t have the context where the error happened.

I don’t know how to fine-tuning the error handing and without breaking the
layered design.


More information about the ffmpeg-devel mailing list