Fix ffprobe Stream Contains No Frames Error
The "Stream contains no frames" error in ffprobe indicates that while a media container defines a specific audio, video, or data track, the analyzer found zero decodable packets or frames within it. This article explains the underlying causes of this error—ranging from truncated files and container metadata mismatches to restrictive probe limits—and provides direct command-line solutions to analyze, repair, or bypass the issue using FFmpeg tools.
What Causes the "Stream contains no frames" Error?
When ffprobe opens a media file, it reads the container header to determine how many streams (video, audio, subtitles) are present. It then reads a portion of the actual data to identify codecs, frame rates, and resolutions. The "Stream contains no frames" error occurs due to three main reasons:
- Ghost Streams: The container metadata (such as an MP4 or MKV header) lists a stream, but the stream contains no actual data. This frequently happens when recording software initializes an audio or subtitle track that never receives input.
- Insufficient Analysis Buffers: In files with delayed streams or sparse data (like subtitles or chapter markers), valid frames exist further down the timeline than ffprobe checks by default.
- Truncated or Corrupt Files: If a recording ends abruptly or a download is interrupted, the container may reference frame indexes that were never written to disk.
How to Fix the Error
Depending on whether the issue is caused by shallow analysis limits, empty tracks, or corruption, use the following methods to resolve it.
1. Increase the Probe Size and Analyze Duration
If the stream is valid but starts late in the file, ffprobe might
give up before reaching the first frame. Increase the scanning limits
using -probesize and -analyzeduration:
ffprobe -probesize 100M -analyzeduration 100M -i input.mp4You can scale these values higher (e.g., 500M or
1G) for large, high-bitrate video files.
2. Identify and Drop the Empty Stream
If the file plays fine but causes automated scripts or transcoding pipelines to fail, locate the empty stream index and exclude it using FFmpeg.
First, identify the problematic stream index:
ffprobe -v error -show_entries stream=index,codec_type -of default=noprint_wrappers=1 input.mp4If stream 0:2 is an empty track causing the error,
re-mux the file to strip it out without re-encoding:
ffmpeg -i input.mp4 -map 0 -map -0:2 -c copy output.mp4Alternatively, map only standard working streams (video and audio) to automatically drop corrupt metadata tracks:
ffmpeg -i input.mp4 -map 0:v:0 -map 0:a:0 -c copy output.mp43. Ignore Errors in Automated Scripts
If you are running ffprobe in a script and want to
ignore empty auxiliary streams to capture data from the working streams,
restrict log verbosity to only fatal errors:
ffprobe -v fatal -show_streams -select_streams v:0 input.mp4Using -select_streams v:0 limits the probe exclusively
to the primary video stream, preventing errors from empty secondary
streams from breaking execution.
4. Repair Corrupt or Truncated Containers
If the entire file fails to read because the recording was interrupted, attempt to rebuild the container index with FFmpeg:
ffmpeg -err_detect ignore_err -i input.mp4 -c copy fixed_output.mp4For severely damaged MP4 or MOV files where the moov atom is missing
or unindexed, use specialized recovery tools like untrunc
to reconstruct the missing frame indexes against a healthy reference
file created with the same settings.