[FFmpeg-devel] [RFC] Question Regarding Parsing Files with Sections of Unknown Length and No Delimiters
Anton Khirnov
anton at khirnov.net
Mon Mar 16 11:55:06 EET 2020
Quoting Anamitra Ghorui (2020-03-15 13:40:58)
> Hello,
>
> I am dealing dealing with a video (gif-like) file format in which there
> are compressed (entropy coded) segments of unknown length. However, the length
> of the uncompressed segment of the file is already known. Please check the
> previous mail by thread if context is required. There are no markers that
> indicate the end of these segments, and these segments are present at the end
> of the file.
>
> One additional problem is that the frames of the video are interleaved, which
> means that the parser will have to be provided with the whole pixel data/frame
> data at once, and cannot be broken into individual frames.
What do you mean by "interleaved" exactly?
>
> I have been trying to figure out how to do go about parsing the file, and I
> have come up with the following approaches:
> 1. Decompress the compressed segment in the parser itself, and supply that in
> the output buffer.
>
> 2. Keep providing the input buffer of arbitrary length as a packet to the decoder.
> The decoder will decompress the stream and process it accordingly. The decoder
> will keep an internal buffer. It will return AVERROR(EAGAIN) until the full
> compressed bitstream has been decoded and AVFrames can be generated.
>
> In this case the parser will not do much aside from finding the start of the
> file stream and returning the buffer.
>
> I think approach 2 will be better in this case because error handling cannot be
> done well in the parser. What do you suggest?
Yes, 2. sounds saner than implementing a decoder inside a parser. The
new decoding API allows for arbitrary M:N mapping of packets to frames,
so this should not be a problem.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list