[FFmpeg-user] Get H264 NALUs from a muxed file

David Cassany Viladomat david.cassany at i2cat.net
Fri Oct 17 19:50:26 CEST 2014


Hi all,

I have a question regarding demuxing files containing H264 data. I am
trying to demux MP4 files and MPEG2-TS files. I have noticed that when I
read a fram in an AVPacket get whole frame (containing several NALUs) in a
different format, in concret in MPEG2-TS I get the data with the start_code
(0001) to divide the NALUs, but with the MP4 I get the frame without start
codes but 4 bytes indicating NALU size instead. I now this is due each
container specification, but I am wondering if there is a way with FFMPEG
to get exactly the same data regardless the container.

The problem I have is that I want to process certain NALUs so I'd like to
get NALUs one by one in a discrete way, assuming this is not possible with
FFMPEG (at least as far as I know) I am dividing NALUs of the frame one by
one parsing AVPacket data. The problem here is that I have to implement
different parsers for every container. Is there a way to solve this? to get
H264 frames in an standarized way? or even better, is it possible to get
NALS one by one with FFMPEG.

Thanks in advance for any advice about this matter.

Best regards,
David


More information about the ffmpeg-user mailing list