[FFmpeg-devel] [RFC] Sending H.264 stream to multiple containers
Peng
howtofly at gmail.com
Tue Jul 16 17:43:44 CEST 2013
Since I was not a CODEC engineer, I just try my best to give my own
understanding.
Please correct me if there is anything wrong.
On 07/16/2013 09:27 PM, Nicolas George wrote:
> Thanks, but now I am even more confused. I see three binary toggles:
>
> - NAL unit stream / Annex B byte stream
>
> - global headers / no global headers
>
> - MP4 compliant / not MP4 compliant
>
> Theoretically, that makes eight combinations, but I suppose most of them are
> impossible / irrelevant.
We have only two binary toggles here:
- NAL unit stream / byte stream
- global header / local header
The third one is a container concept, not a CODEC one.
For an explanation, let me quote the standard (ISO 14496-15):
"No start codes. The elementary streams shall not include start codes.
As stored, each NAL unit is
preceded by a length field as specified in 5.2.3; this enables easy
scanning of the sample’s NAL units.
Systems that wish to deliver, from this file format, a stream using
start codes will need to reformat the
stream to insert those start codes."
"Length: Indicates the length in bytes of the following NAL unit. The
length field can be configured to be
of 1, 2, or 4 bytes."
Note that the size of the length field is configurable and is recorded
in a separate field of 'avcC' box.
>
> You say that the lavf MOV muxer transforms into MP4-compliant structure.
> Logically, the MOV demuxer should do the reverse transformation, and nobody
> should worry about except people implementing MOV tools and people examining
> a MOV file in a binary editor. Am I missing something?
No. I totally agree with you in that the reverse transformation should be
done in MOV demuxer. Why use external filter instead?
> That leaves four combinations:
>
> 1. NAL unit stream with global headers;
> 2. NAL unit stream without global headers;
> 3. Annex B byte stream with global headers;
> 4. Annex B byte stream without global headers.
>
> I suspect the third one is useless, but I really do not know. Can you tell
> for each combination in what kind of circumstances it is used? For example,
> what goes in Matroska? I suspect 1. What goes in MPEG-TS? I suspect 4. What
> goes in RTP? I have no idea.
I think there is no essential difference between NAL unit stream
and byte stream, except that almost all encoders I have encountered
prefer the latter one.
Not familiar with Matroska, sorry.
ISO base media file format, both format with global header will be okay.
MPEG-TS, yes, use byte stream with local headers. Otherwise, random
access will be a problem.
RTP, both global header and local header are okay.
When using local headers, decoder configuration information will
be transported in band. When using global header, such information will
be transported once out of band (usually reliably), e.g. in SDP
when establishing an RTSP session. Local headers provide you robustness,
but
with higher bitrate consumption.
HTH
--
Peng
More information about the ffmpeg-devel
mailing list