[Ffmpeg-devel] [PATCH] FLV decoder metadata reading

Allan Hsu allan
Mon Dec 11 09:49:20 CET 2006


On Dec 10, 2006, at 9:53 AM, Michael Niedermayer wrote:

[...]
>>> hmm, what about leaving the metadata reading in flv_read_packet()  
>>> and
>>> clearing AVFMTCTX_NOHEADER as soon as all needed data is available?
>>
>> This would cause flv_read_header() to seek to the end of the stream
>> if !url_is_streamed() when it tries to determine duration, which
>> undesirable in my case, where I want to begin decoding of a  
>> partially-
>> downloaded FLV before the entire file is available. In this case, the
>> FLV isn't "streamed" in the non-seekable sense, but a seek and read
>>> from the end would block until that portion of the file is  
>>> available.
>
> see latest svn, i think ive solved this problem

Oh! I did not know if that it was OK to create incomplete streams.  
This changes a lot of things.

>
> [...]
>> IMHO, this functionality should be the subject of a different series
>> of patches that also address these issues:
>> 1) the FLV muxer does not currently write this metadata.
>> 2) the FLV muxer is currently broken such that -vcodec copy produces
>> bad output for non-H263 video codecs (video tags are unconditionally
>> marked as H263).
>
> yes fixes to the flv muxer should be in seperate patch(es) ...
> still what good does most of the metadata do if not for stream copy?

[...]

>> +    if(key) { //only look for values for the context when key !=  
>> NULL
>> +        if(amf_type == AMF_DATA_TYPE_BOOL) {
>> +            if(!strcmp(key, "stereo"))               context- 
>> >is_stereo    = num_val;
>> +        } else if(amf_type == AMF_DATA_TYPE_NUMBER) {
>> +            if(!strcmp(key, "duration"))             s- 
>> >duration           = num_val * AV_TIME_BASE;
>> +            else if(!strcmp(key, "width"))           context- 
>> >width        = num_val;
>> +            else if(!strcmp(key, "height"))          context- 
>> >height       = num_val;
>> +            else if(!strcmp(key, "audiocodecid"))    context- 
>> >audiocodecid = num_val;
>> +            else if(!strcmp(key, "videocodecid"))    context- 
>> >videocodecid = num_val;
>> +            else if(!strcmp(key, "audiosamplerate")) context- 
>> >samplerate   = num_val;
>> +            else if(!strcmp(key, "audiosamplesize")) context- 
>> >samplesize   = num_val;
>
> IMHO these should be set directly in AVCodecContext without the  
> intermediate
> FLVDemuxContext layer

Same as above. New patch attached that writes metadata straight into  
the streams.

	-Allan
--
Allan Hsu <allan at counterpop dot net>
1E64 E20F 34D9 CBA7 1300  1457 AC37 CBBB 0E92 C779
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flvdec_metadata.patch
Type: application/octet-stream
Size: 8827 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061211/830ac291/attachment.obj>
-------------- next part --------------





More information about the ffmpeg-devel mailing list