[FFmpeg-devel] [PATCH 2/2] Enable parsing in FLV container

Alex Sukhanov alx.sukhanov at gmail.com
Fri Dec 13 00:16:54 CET 2013


On Thu, Dec 12, 2013 at 7:53 AM, Michael Niedermayer <michaelni at gmx.at>wrote:

> On Wed, Dec 11, 2013 at 09:40:49PM -0800, Alex Sukhanov wrote:
> > On Wed, Dec 11, 2013 at 7:34 PM, Michael Niedermayer <michaelni at gmx.at
> >wrote:
> >
> > > On Wed, Dec 11, 2013 at 05:49:07PM -0800, Alex Sukhanov wrote:
> > > > ---
> > > >  libavformat/flvdec.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> > > > index 1024001..b19db0e 100644
> > > > --- a/libavformat/flvdec.c
> > > > +++ b/libavformat/flvdec.c
> > > > @@ -256,6 +256,7 @@ static int flv_set_video_codec(AVFormatContext
> *s,
> > > AVStream *vstream,
> > > >          return 1;     // 1 byte body size adjustment for
> > > flv_read_packet()
> > > >      case FLV_CODECID_H264:
> > > >          vcodec->codec_id = AV_CODEC_ID_H264;
> > > > +        vstream->need_parsing = AVSTREAM_PARSE_FULL;
> > >
> > > full parsing needs some extra parsing and spliting over the data
> > > and could cause some slowdown
> > >
> > >
> > > >          return 3;     // not 4, reading packet type will consume one
> > > byte
> > > >      case FLV_CODECID_MPEG4:
> > > >          vcodec->codec_id = AV_CODEC_ID_MPEG4;
> > > > --
> > > > 1.8.5.1
> > > >
> > > > _______________________________________________
> > > > ffmpeg-devel mailing list
> > > > ffmpeg-devel at ffmpeg.org
> > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > >
> > >
> > > --
> > > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> > >
> > > Concerning the gods, I have no means of knowing whether they exist or
> not
> > > or of what sort they may be, because of the obscurity of the subject,
> and
> > > the brevity of human life -- Protagoras
> > >
> > > _______________________________________________
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel at ffmpeg.org
> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > >
> >
> > Hi Michael,
> >
> > This is how it's implemented in MPEG2TS Demuxer:
> >
> http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/mpegts.c;h=d67c63a4de20480d351c7d089467e923241cdefa;hb=HEAD#l688
>
> mpeg ts needs a parser as the bytestream doesnt come packaged in AUs
> but can be in random pieces of bytes unrelated to AU boundaries
>
>
> > Let me know please how you would like to process here.
>
> its hard to say as most questions are unawnsered
> is PAFF allowed in flv ?
> is the duration from the codec bitstream matching the container
> duration ?
> does AVSTREAM_PARSE_HEADERS work too ?
> does the demuxer have enough information to set the durations ?
>
> i suspect setting the duration from the demuxer is the best solution
> if that is easily possible. If not then AVSTREAM_PARSE_HEADERS could
> be tried.
> full parsing causes a slowdown and the durations are generally not
> needed by user applications so some means to allow a user app to
> avoid this extra step would then make sense. That is allow a user
> app to inform avformat about what information it needs, like duration
> or r_frame_rate, ...
>
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If a bugfix only changes things apparently unrelated to the bug with no
> further explanation, that is a good sign that the bugfix is wrong.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
FLV is just a container. so question about PAFF is a codec question.
Processing should be the same in FLV and M2TS, I think.

Your words about FULL_PARSER make sense, so I checked
AVSTREAM_PARSE_HEADERS and it works also just fine.
I modified my patch.

Sorry, I did some things in wrong way and eventually decided to send
separate patch:
http://ffmpeg.org/pipermail/ffmpeg-devel/2013-December/151921.html

Please just drop this one.

Thank you


More information about the ffmpeg-devel mailing list