How to Read FFprobe Packet Corrupt Warnings
The "Packet corrupt" warning in ffprobe indicates that a
specific frame or data segment within a media container fails validation
checks during parsing or decoding. This article explains what causes
this warning, how to extract precise packet-level diagnostic data using
ffprobe, how to locate the damaged segment in your file,
and what the corruption means for playback and processing.
What "Packet Corrupt" Means
When ffprobe scans a file, it unpacks the container
format (such as MP4, MKV, or TS) and inspects the individual elementary
stream packets (audio, video, subtitles). If the demuxer or codec parser
detects missing bytes, an unexpected frame size, broken headers, or
mismatched checksums, FFmpeg marks the packet with the
AV_PKT_FLAG_CORRUPT flag and logs a warning:
[mp4 @ 0x...] Packet corrupt (stream = 0, dts = 123456)
This warning is typically non-fatal. It means the container itself is readable, but the raw data for that specific frame is partially lost or mangled.
How to Expose Corrupt Packets in FFprobe
By default, simple ffprobe commands might suppress
packet-level warnings unless you explicitly query packet details or
adjust log levels. To identify every corrupt packet, inspect the packet
stream directly:
ffprobe -v warning -show_packets -select_streams v:0 input.mp4To narrow the output specifically to corrupted packets, request the
packet flags, presentation timestamp (pts), and decode
timestamp (dts):
ffprobe -v error -show_entries packet=codec_type,stream_index,pts_time,dts_time,flags -of csv input.mp4 | grep "c"In the output, the flags field represents the status of
the packet:
K— Keyframe (I-frame)_— Non-keyframec— Corrupt packetd— Discarded packet
A flag showing _c_ or Kc_ explicitly marks
a corrupted frame.
Key Fields to Interpret
When evaluating a corrupted packet, pay attention to the following metadata:
stream_index/codec_type: Identifies whether the corruption affects video, audio, or metadata. Video packet corruption often results in visual macroblocking or dropped frames; audio packet corruption typically causes pops, silence, or desynchronization.pts_time/dts_time: Provides the exact timestamp (in seconds) where the damage occurs. Use this timestamp to jump directly to that point in a player or video editor to visually inspect the defect.pos: The byte offset inside the container. This helps determine whether the file suffered disk/download corruption at a specific physical sector.flags: A corrupt keyframe (K) is significantly worse than a corrupt delta frame (_). If an I-frame is corrupted, every subsequent frame that relies on it (the entire GOP) will display visual artifacts until the next keyframe arrives.
Practical Impact and Next Steps
- Minor Glitches: If only a single non-keyframe packet is corrupt, modern decoders usually conceal the error by skipping the frame or interpolating motion, making the defect barely noticeable.
- Stream Desync: In live-stream captures or MPEG-TS files, a corrupt audio packet can disrupt clock synchronization, causing audio/video drift.
- Remuxing and Transcoding: When copying streams
(
ffmpeg -i input.mp4 -c copy output.mp4), corrupt packets may be discarded or copied over as-is, which can trigger errors in strict playback software. Re-encoding the file (-c:v libx264) allows FFmpeg's decoder to apply error concealment and generate a standard-compliant, repaired output file.