[FFmpeg-devel] [PATCH] better detection of available streams for flv

Michael Niedermayer michaelni
Mon Apr 14 00:51:15 CEST 2008


On Mon, Apr 14, 2008 at 12:09:03AM +0200, Reimar D?ffinger wrote:
> On Sun, Apr 13, 2008 at 09:19:40PM +0200, Michael Niedermayer wrote:
> > On Sun, Apr 13, 2008 at 09:04:52PM +0200, Reimar D?ffinger wrote:
> > > On Sun, Apr 13, 2008 at 07:57:44PM +0200, Michael Niedermayer wrote:
> > > > On Sun, Apr 13, 2008 at 06:06:00PM +0200, Reimar D?ffinger wrote:
> > > > > Hello,
> > > > > with e.g. http://eurovision.tv/upload/video/2008/WELCOMETOBELGRADE.flv
> > > > > the flv demuxer thinks that there is no video stream.
> > > > > Attached code changes the code to create a audio/video stream if the
> > > > > metadata-parsing code finds a key starting with "audio" or "video" and
> > > > > there is not yet such a stream.
> > > > > Obviously, there are many other ways to do this, and if such a change is
> > > > > done the hack in flv_read_header should probably be removed.
> > > > > Instead of checking for any key starting with audio/video this could of
> > > > > course be restricted to those we actually handle, namely audiocodecid,
> > > > > videocodecid, audiosamplesize, audiosamplerate and stereo.
> > > > 
> > > > We support flv with invalid headers since r10887. Which does not depend on
> > > > metadata. Why does this not suffice?
> > > 
> > > I think you mean the hack in flv_read_header?
> > 
> > no i mean:
> > 
> >     if(i == s->nb_streams){
> >         av_log(NULL, AV_LOG_ERROR, "invalid stream\n");
> >         st= create_stream(s, is_audio);
> >     }
> > 
> > that is if this packet belongs to a stream which we dont have create it.
> 
> I have no idea how this is supposed to work even remotely, the metadata
> that contains the codec id etc. is long past and has been ignored.

The metadata is not needed to identify the codec.
grep for flv_set_video_codec


> It might also not work well if the second stream starts rather late in
> the file, I doubt all lavf users can handle a stream appearing during
> playback well.

av_find_stream_info() will check if the demuxer can add streams later
(AVFMTCTX_NOHEADER) and if so preread a little.
Though i see now AVFMTCTX_NOHEADER is missing in flvdec.c ...


> It would be possible to use this code (and at the same time get rid of a
> lot of extra checks in amf_parse_object) if the codec info etc. would
> first be stored in the context and then used in create_stream to fill
> the info appropriately.
> Not sure if it is really much better.

I dont know the best soluton either, but i know that i like to understand the
problem first.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080414/77b0f5bd/attachment.pgp>



More information about the ffmpeg-devel mailing list