[FFmpeg-devel] Question regarding FLV Metadata patch dated 10 Sep, 2010

Pranav Desai pranavadesai at gmail.com
Wed Oct 5 20:11:18 CEST 2011


Hello,

I have a question regarding a patch that adds metadata to flv output.

Here is the link to the patch
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=16f825085a53dc7241ef375e9bed9856435d4c16

Actually I ran into an issue when transcoding Youtube videos. The input
video has size 608x272 but after transcoding the size of the output video is
320x240, as it plays on youtube.

After digging a bit further it looks like the metadata that is added by this
patch adds the width and height as strings, so the Youtube player might not
be able to read it and hence uses the default size. The video plays fine the
only problem is that its squished into letterbox format because of the
metadata.

After remove the patch it seems to work just fine, the metadata looks fine
and the size is also fine.

For this test I used 'copy' codecs to eliminate all other possibility.

I checked the metadata which is include below using flvlib (
http://pypi.python.org/pypi/flvlib/0.1.5). The output is included below. The
output shows that width and height are added as strings vs the original
'in.flv' file where its double.

So I guess the question is, should it be adding only the metadata that is
not already added like 'canseekontime' ? Because just above this patch in
the code there are quite a few places that add the metadata like width,
height,  audio/videodatarate, etc. so why add it again ?

The second question is, if this patch is adding it to buffer after the code
above it (which has already added width and height), what happens to that
metadata ? I was assuming that the put_amf_* family appends to a buffer. If
that is the case then shouldn't I see 2 metadata tags in flvlib output, am I
missing something ?

Thanks for your time.

-- Pranav


-- input metadata ------------------------------
---------------------------
debug-flv -m in.flv

=== `in.flv' ===
#00001 <ScriptTag onMetaData at offset 0x0000000D, time 0, size 843>
{'duration': 180.848,
 'starttime': 0.0,
 'totalduration': 180.848,
 'width': 608.0,
 'height': 272.0,
 'videodatarate': 661.344952667,
 'audiodatarate': 122.225184842,
 'totaldatarate': 790.420298725,
 'framerate': 29.9754489958,
 'bytelength': 17920793.0,
 'canseekontime': True,
 'sourcedata': 'BADC23505HH1317405462787301',
 'purl': '',
 'pmsg': '',
 'httphostheader': 'o-o.preferred.iad09s12.v15.lscache2.c.youtube.com'}

-- output metadata ---------------------------------------------------------

debug-flv -m out.flv
=== `out.flv' ===
#00001 <ScriptTag onMetaData at offset 0x0000000D, time 0, size 553>
{'duration': '181',
 'width': '608',
 'height': '272',
 'videodatarate': '661',
 'framerate': '30',
 'videocodecid': 7.0,
 'audiodatarate': '122',
 'audiosamplerate': 44100.0,
 'audiosamplesize': 16.0,
 'stereo': True,
 'audiocodecid': 10.0,
 'starttime': '0',
 'totalduration': '181',
 'totaldatarate': '790',
 'bytelength': '17920793',
 'canseekontime': 'true',
 'sourcedata': 'BADC23505HH1317405462787301',
 'purl': '',
 'pmsg': '',
 'encoder': 'Lavf53.4.0',
 'filesize': 17920503.0}


More information about the ffmpeg-devel mailing list