FFmpeg "Could not find codec parameters for stream": causes and fixes

By the FixMP4 engineering team · · 8 min read

FFmpeg prints "Could not find codec parameters for stream 0 (Video: h264 ...): unspecified size" when it has read the start of a file but could not learn essential details about a stream, such as the frame dimensions or the audio sample format. It then suggests increasing the analyzeduration and probesize options. That suggestion is right for some inputs (live streams, transport streams, files with a long silent or blank lead-in) and useless for others (MP4 files whose index points at empty or damaged data). Knowing which case you have saves a lot of trial and error.

What FFmpeg is doing when it prints this

Before converting or copying anything, FFmpeg probes the input. For each stream it wants a codec, dimensions, pixel format, sample rate and similar parameters. Containers like MP4 and MOV store these in the header (in the sample description inside the moov box), and FFmpeg can usually fill them in immediately. Containers like MPEG-TS, raw H.264 or FLV carry them inside the stream itself, so FFmpeg has to read and decode data until it finds them.

The warning appears when that search ends without success. Three broad reasons exist:

  1. The information is further away than FFmpeg looked. Common with transport streams, IPTV captures and recordings that start mid-stream.
  2. The information is missing or corrupt. The codec configuration was never written, or the header area is damaged.
  3. The data the header points to is empty or not media. Typical of MP4 recordings that were cut off and then partly reconstructed, or that sit on damaged storage.

Step 1: read the full warning

The line has more detail than people notice. For example:

`` [mov,mp4,m4a,3gp,3g2,mj2 @ 0x...] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080): unspecified pixel format ``

  • The container name at the start tells you which demuxer FFmpeg chose. "mov,mp4,..." means an MP4 or MOV; "mpegts" means a transport stream; "h264" means a raw elementary stream.
  • The stream description shows what is known. Here the dimensions are known but the pixel format is not, which usually means the decoder never received a valid frame.
  • The reason at the end (unspecified size, unspecified pixel format, unspecified sample format, unknown codec) narrows down the missing piece.

Step 2: try a deeper probe

For transport streams, raw streams and captures that start in the middle of a broadcast, give FFmpeg more room. Both options go before the input:

`` ffprobe -analyzeduration 100M -probesize 100M -i input.ts ``

The values are in microseconds for analyzeduration and bytes for probesize; 100M is generous. If the stream info now appears, use the same two options in your ffmpeg command. This is the fix for most "unspecified size" warnings on .ts files, DVB recordings and HLS segments that begin without a keyframe.

Step 3: check that the stream contains real data

For MP4 and MOV files, a deeper probe rarely helps, because FFmpeg reads parameters from the header rather than searching. If the warning persists, test whether any frame can be decoded:

`` ffmpeg -v error -i input.mp4 -map 0:v:0 -frames:v 1 -f null - ``

If this prints decoding errors and no frame, look at the file with a hex viewer (HxD on Windows, Hex Fiend on macOS, xxd on Linux). Large regions that are only zeros, especially near the start of the media data, mean the frames were never written or were lost on the storage. No setting can bring them back, though the parts that still contain data may be recoverable.

Step 4: when the index is missing or wrong

A related situation is very common with phone, camera and screen recordings. The recording stopped unexpectedly, the moov index was missing, and a quick-fix tool or an earlier repair attempt wrote a placeholder header. FFmpeg then sees a stream declared as H.264 or HEVC but finds no valid configuration, and prints this warning. Files with no moov at all usually fail earlier with "moov atom not found", which has its own guide to fixing moov atom not found.

In both cases the frames are often intact in the media data. They need a new, correct index built by scanning the data, and a codec configuration taken from a working file recorded by the same device and settings. That is what the FixMP4 repair tool does, entirely in your browser so the file is not uploaded. It supports H.264 and HEVC video with AAC audio in MP4, MOV and M4A, and shows a free preview of your recovered footage before you pay for the export. Always run it on the untouched original, not on a copy that another tool already modified.

Other causes worth ruling out

  • Unsupported or experimental codec: an old FFmpeg build may not recognise a newer codec. Update FFmpeg and check ffmpeg -decoders for the codec name.
  • Encrypted content: DRM-protected files expose their streams but cannot be decoded. FFmpeg may warn about missing parameters instead of saying the file is encrypted.
  • Data and timecode tracks: camera files sometimes contain a track that is not audio or video. A warning about that stream is harmless; map only the streams you need with -map 0:v -map 0:a.
  • Truncated downloads: if the file came from the internet, compare its size with the source and download it again.

Quick reference

SituationWhat to do
MPEG-TS, raw H.264, live captureRaise analyzeduration and probesize
Harmless data or timecode trackMap only audio and video
MP4/MOV, stream declared but undecodableCheck for zero-filled data, then rebuild the index
Old FFmpeg, new codecUpdate FFmpeg
Protected or encrypted fileNot repairable; get an unprotected copy

For a broader set of commands that help damaged files, see FFmpeg repair MP4, and if FFmpeg refuses a file outright, the invalid data found when processing input guide is the next stop.

Frequently asked questions

Is "Could not find codec parameters" an error or a warning?

FFmpeg prints it as a warning and continues, but the affected stream usually cannot be decoded or copied correctly. If the command then fails or produces a file without that stream, treat it as the real cause.

What do analyzeduration and probesize actually change?

They control how much of the input FFmpeg reads before deciding what each stream contains. Raising them lets it look further into the file for the first decodable header or keyframe. They do not repair anything; they only help when the needed information exists later in the file.

Why does the message say "unspecified size"?

For video, FFmpeg needs the frame width and height. These normally come from the codec configuration (for H.264 and HEVC, the SPS). When FFmpeg cannot find or parse that configuration, the size stays unknown and the warning names it.

Can I fix this on a file recorded by my phone or camera?

If the file is an MP4 or MOV whose index was lost, yes in many cases: the frames are still there and a tool can rebuild the index using a working clip from the same device to supply the codec configuration.

Have a broken recording right now?

Diagnose it and hear or watch a free repaired preview. Nothing is uploaded.

Open the repair tool
  • FFmpeg
  • ffprobe
  • error messages
  • MP4
  • codecs