AVC File Documentation


Summary

An .avc file is MPEG-4 AVC (H.264) video, usually a raw elementary stream with no container and no audio, the kind exported by capture cards, encoders and some CCTV gear. Because it has no container, generic players often refuse it; VLC plays it, and its MIME type is video/h264. The clean fix is to remux it into MP4 or MKV losslessly with ffmpeg: ffmpeg -i in.avc -c copy out.mp4. Some .avc files are just renamed MP4s.

Technical details

FeatureValue
Full nameMPEG-4 AVC / H.264 video
File extension.avc
MIME typevideo/h264
Format typeRaw H.264 elementary stream (usually no container, no audio)
StandardITU-T Rec. H.264 / ISO/IEC 14496-10 (MPEG-4 Part 10)
DevelopersISO/IEC MPEG and ITU-T VCEG (Joint Video Team)
Finalised2003
Open standardYes — published ITU-T/ISO standard (patent-licensed)
Stream structureNAL units in Annex B byte-stream format
Start code (hex)00 00 00 01 (or 3-byte 00 00 01)
First NAL unitsSPS (type 7, 0x67) then PPS (type 8, 0x68)
AudioNone — raw video only
Timing / indexNone — supplied when remuxed into a container
Identical formats.h264, .264
Common containersMP4, MKV, MOV, MPEG-TS
Related extensions.h264, .264, .mp4, .mkv, .ts
Specificationitu.int/rec/T-REC-H.264
File signature (magic bytes)
00 00 00 01 67

Offset 0. Most .avc files are a raw H.264 elementary stream: a run of NAL units in Annex B format, each introduced by the start-code prefix 00 00 00 01 (or the 3-byte 00 00 01). The first NAL is normally an SPS (type 7, byte 0x67), followed by a PPS (type 8, 0x68). This is not a container signature, so there is no ftyp box, no audio and no duration. A minority of .avc files are actually a renamed MP4: those show 66 74 79 70 (ftyp) at offset 4 and play once renamed to .mp4.

What is an AVC file?

An .avc file is video compressed with H.264, also called AVC (Advanced Video Coding) or MPEG-4 Part 10. H.264 was finalised in 2003 jointly by the ISO/IEC Moving Picture Experts Group (MPEG) and the ITU-T Video Coding Experts Group (VCEG), and it underpins Blu-ray, broadcast, YouTube and most streaming. But “AVC” names a codec, not a container, and that distinction is the key to the whole format: an .avc file is almost always a raw H.264 elementary stream, the encoder’s direct output with no wrapper around it.

A raw stream is not a normal media file. It has no container such as MP4 or MKV, no audio track, and no frame-timing or seek index. That is why players and editors expecting a container frequently cannot open it, or open it but show no duration. This is exactly the same format as .h264 and .264, just under a third extension. The sections below explain the byte-level structure of the stream and why the standard fix is to remux it into a container.

NAL units and the Annex B byte stream

H.264 organises coded video into NAL units (Network Abstraction Layer units). Each NAL unit is a self-contained packet: a slice of a picture, or a parameter set describing how to decode the pictures. In a raw .avc file the NAL units are stored in the Annex B byte-stream format, where each unit is preceded by a start-code prefix so a decoder can find unit boundaries by scanning the bytes:

00 00 00 01  [NAL header]  [payload...]   4-byte start code
00 00 01     [NAL header]  [payload...]   3-byte start code (also valid)

Immediately after the start code comes a one-byte NAL header. Its low 5 bits are the nal_unit_type, and the two bits above that are nal_ref_idc (how important the unit is for referencing). So the first byte after a start code encodes both the type and the reference priority. To stop a start code from appearing by accident inside payload data, the encoder inserts emulation prevention bytes: any naturally occurring 00 00 00, 00 00 01 or 00 00 02 in the payload is broken up by a 0x03 byte, which the decoder strips out. This is why you cannot reliably search raw payload for a start code without accounting for the 0x03 escape.

SPS and PPS: the parameter sets

Before any picture can be decoded, the decoder needs to know the video’s resolution, profile, level and structure. That information lives in two parameter-set NAL units that normally begin the stream:

NAL typeFirst byteMeaning
70x67Sequence Parameter Set (SPS): resolution, profile/level, frame/field, chroma format
80x68Picture Parameter Set (PPS): entropy coding mode, slice-group and reference settings
50x65IDR slice: an instantaneous-decoder-refresh keyframe
10x61Non-IDR coded slice: P- or B-frame data

The byte 0x67 is simply NAL type 7 with a reference priority set, which is why an SPS typically appears as 00 00 00 01 67 ... at the very start of an .avc file. The SPS carries the sequence-wide parameters (including the coded width and height, expressed in macroblock units with optional cropping), and the PPS carries picture-level parameters such as whether CABAC or CAVLC entropy coding is used. An IDR picture (type 5) is a clean keyframe: it can be decoded with no reference to earlier pictures, so it is the point a player can start from. Ordinary coded slices (type 1) hold the P- and B-frame data that reference other frames.

What the raw stream leaves out

The Annex B stream contains the compressed pictures and the parameters to decode them, and nothing else. Crucially it has no presentation timestamps, no frame-rate declaration, no audio, and no index of where each frame starts. A container format supplies all of that. Because the raw stream omits timing, a decoder that plays it back has to assume or be told a frame rate; if it guesses wrong the video runs too fast or too slow. And because there is no index, seeking is limited to scanning for the next IDR picture. This is the technical reason a raw .avc often plays only in VLC (which includes a demuxer willing to consume the bare stream) and fails in players that expect an indexed container.

Remuxing into a container, losslessly

The fix is not to re-encode the video but to remux it: wrap the existing NAL units in a container that adds the timing, index and (optionally) audio the stream lacks. With ffmpeg this is a stream copy, so it is near-instant and loses no quality:

ffmpeg -i in.avc -c copy out.mp4          # wrap into MP4, no re-encode
ffmpeg -framerate 25 -i in.avc -c copy out.mp4   # if timing is wrong
ffmpeg -i in.avc -c copy out.mkv          # MKV is the most forgiving target

During remuxing, the muxer converts the Annex B start-code framing into the length-prefixed sample layout that MP4 uses, and it lifts the SPS and PPS out of the stream into the file’s avcC configuration record inside the sample description. That is the same avcC box an ordinary MP4 carries for its H.264 track, which is why a remuxed file plays everywhere a normal MP4 does. If the MP4 muxer complains about an unusual stream, MKV is the most tolerant container. If a player reports that the .avc is already an MP4, the file was simply renamed and you can rename it back to .mp4.

Unrelated files that use the .avc extension

A couple of programs reuse .avc for things that are not video. Some Kaspersky antivirus products store virus-definition update data in .avc files; these open only inside the antivirus and should not be played or converted. Avid Media Composer can also save a script or transcript file with the .avc extension, unrelated to the codec. If a .avc does not start with a NAL start code or an ftyp box, it is probably one of these rather than an H.264 stream.

Frequently asked questions

How do I play an .avc file?

Use VLC, which plays raw H.264 streams directly; if needed, select the H.264 demuxer in Preferences › Input/Codecs. Most other players fail because the file usually has no container. For everyday use, remux it to MP4 first with ffmpeg.

How do I convert an .avc file to MP4?

Remux it with ffmpeg: ffmpeg -i input.avc -c copy output.mp4. This wraps the existing video in an MP4 container with no re-encoding and no quality loss. Add -framerate 25 if the playback speed is wrong.

Why is there no sound in my .avc file?

A raw H.264/AVC stream is video only; it carries no audio track by design. Any audio would have been exported separately or lived in a containerised file. After remuxing to MP4 or MKV you can mux an audio track in alongside the video.

References