[FFmpeg-devel] h264-parser splits before PPS thus muxing to mp4 fails

Baptiste Coudurier baptiste.coudurier
Wed Jan 30 14:42:32 CET 2008


Thorsten Jordan wrote:
> Thorsten Jordan schrieb:
>> Thorsten Jordan schrieb:
>>> Hello,
>>> i encountered a problem while remuxing h264 material from TS to MP4.
>>> Video stream is copied, Audiostream transformed from AC3 to AAC, but
>>> only video matters here.
>>> The problem is that the input reader uses h264_parser to split the data,
>>> which exits just after SPS is found (h264_parser.c line 129 ff) but the
>>> MP4 muxer wants SPS and PPS, thus the assertion in mov_write_avcc_tag
>>> fails (movenc.c line 478).
>> Maybe it should be extended by ignoring SEI here as well?
> and one more problem with the splitter vs. the movenc. If the h264
> elementary stream starts with some rest before the 00 00 00 01 x9 of the
> AUD (can happen when source is from TS), then this leads to a failed
> condition in movenc.c (line 486) and thus that data is just written to
> the mp4 without any checks leading to a corrupt file.
> If i ensure that the extradata starts with 00 00 00 01 before giving
> that to the movenc, it works fine, the resulting mp4 is ok. I don't know
> however if that check should be part of the splitter as well or must be
> performed independently of the splitter.

Can you update to latest svn please ? movenc.c has changed, so I can't
see the correspondance with the current code.

You must pass extradata to mov muxer formatted as NAL units with
startcodes (annex b) and those nal units must at least contains one sps
and pps, or raw extradata like mov itself (mkv should work too) contains.

Besides I do think split should extract sps and pps and put them into
extradata, though maybe splitters are deprecated IIRC, and therefore
your efforts should be put in a bitstream filter h264 annex b to mp4/mov
(see mp4_to_annexb bitstream filter already present), which will
reformat bitstream (startcodecs) and extract sps/pps to extradata.

Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312

More information about the ffmpeg-devel mailing list