can we add Cue points from xml file like in flvtool2

42 views
Skip to first unread message

aditya

unread,
Mar 30, 2011, 9:03:45 AM3/30/11
to FLVmeta Discussion
This feature of flvtool2 has made it most popular.
There is a previous discussion regarding this .

If we can how does one go about doing it

aditya

unread,
Mar 30, 2011, 11:07:04 AM3/30/11
to FLVmeta Discussion
Ok i got the answer from this
http://stackoverflow.com/questions/5486081/flvmeta-add-cuepoints-to-flv-from-xml-tags-file/5486914#5486914.

Marc
1 . can you tell me how i can get the run the flvtool2 as is without
the exe.? I have tried compiling the source which is a total pain as i
seem to be missing some dependencies and maybe not compiling the right
file with rubyscript2exe.

2 If you can guide me i would like to try and add this functionality
to flvmeta.

3. Also i am lead to believe cue point injection would take a lot of
time because we are traversing the video data?. it certainly does with
flvtoo2.

Any way we can chat?

Marc

unread,
Mar 30, 2011, 11:45:55 AM3/30/11
to FLVmeta Discussion
Hi,

This is a commonly requested feature. I have plans to implement it
after the next release.

I'll have to choose a proper XML parser (probably expat), and support
the XML format used by flvtool, or one of the formats I have posted at
http://schemas.flvmeta.org/.
I guess I can easily support YAML and JSON, too, as flvmeta embeds
YAML and JSON parsing libraries.

About flvtool, if you have a local ruby installation, you only have to
type "gem install flvtool2" which will create the appropriate wrapper
script which you'll be able to execute as if it were a native
executable program. You'll then be able to locate the flvtool ruby
files on your system using your favorite search tool, and start to
hack at your leisure :)
No compilation will be ever involved, ruby was designed like this,
write scripts, and execute them directly.

I believe implementing cuepoint injection in flvmeta might require a
relatively deep knowledge of the source code, but it's GPL, so you can
do whatever you want with it, as long as anything you release is GPL
too !

Now for the technical details, there are a few things that must be
taken into account.

First of all, if cuepoints are injected in the metadata tag, it will
cause the onMetadata tag to become bigger, therefore, all existing
keyframe indices will become invalid because the file offsets will
have changed too, so you'll have to recompute every keyframe offset by
adding the difference between the size of the metadata before, and
after the injection.

It becomes more complicated if the cuepoints are injected at various
points in the file, because the same problem will apply, but the new
offsets will have to be computed differently after each cuepoint is
inserted, so you'll have to modify the onMetadata tag after having
written the file once, causing another write, this time only modifying
existing data, since the onMetadata tag will not become bigger by only
modifying the existing numeric offsets to keyframes.
It is also possible to compute all offsets before writing the file, by
keeping all AMF cue points in memory, and adding their total size to
the correct offsets of the metadata that will have to be kept in
memory too...

It should be very fast with flvmeta, depending on the file size, of
course. At least, the speed should be comparable to the current
metadata injection speed.

Chatting will be difficult for me, I have very little time to do so,
better use the flvmeta dev group to discuss about it.

If you need any pointer to start hacking flvmeta, please don't
hesitate, I should find a moment to reply (but don't expect me to
reply immediatly ;-) ).

Regards,
Marc

On Mar 30, 5:07 pm, aditya <adi...@gmail.com> wrote:
> Ok i got the answer from thishttp://stackoverflow.com/questions/5486081/flvmeta-add-cuepoints-to-f....

Aditya Game Programmer

unread,
Mar 30, 2011, 12:16:09 PM3/30/11
to flvmeta...@googlegroups.com
Thank you for the reply, i understand the chatting part .Glad to know you are active on This. 

aditya

unread,
Mar 31, 2011, 8:11:06 AM3/31/11
to FLVmeta Discussion
The flvtool2 when run directly by the script after the gem install
behaves very differently from the exe file that was given. It breaks
for large file sizes where exe works.i was testing an flv of 1 hour
duration. This shows the bug http://lzone.de/flvtool2+1.0.6+bugs.

FLVmeta works similarly to flvtool++ right? takes input flv calculates
the metadata information and then injects the same into the newly
generated output flv file.

The concept of cue point injection would be its also a part of the
metadata hence it would be stored into the buffer along with the other
metadata information got from the file. hence while writing the output
file this would be appended to the data to be written.

What you are saying is the case when there is already metadata present
in the flv. Lets assume we have a raw file or flv with no metadata.
would this not make things simple i.e no issue of offset errors?

I have exposure to tinyxml++ . lets say we get the cue point data
from the xml file and store them in buffers. the actual file which
writes the data into flv is in the update.c right?
/*
Write the flv output file
*/
from line 722 onwards.
so we would have to add code to write the cue point data here ?.

I use codebocks and windows xp and i am still trying to figure out how
to get the source to compile using the cmake .i would appreciate any
help ( instructions ) regarding this . I have read in the news " Added
support for CMake builds in addition to autotools. It is now the
official way to build flvmeta on Windows. " . any where i can find
more detailed instructions on this?

Are there any external dependencies that affect flvmeta?

Thanks

Marc

unread,
Apr 1, 2011, 9:59:48 AM4/1/11
to FLVmeta Discussion
On Mar 31, 2:11 pm, aditya <adi...@gmail.com> wrote:
> The flvtool2 when run directly by the script after the gem install
> behaves very differently from the exe file that was given. It breaks
> for large file sizes  where exe works.i was testing an flv of 1 hour
> duration.  This shows the bughttp://lzone.de/flvtool2+1.0.6+bugs.

this is weird, where does that 'compiled' flvtool2 come from ?

> FLVmeta works similarly to flvtool++ right? takes input flv calculates
> the metadata information and then injects the same into the newly
> generated output flv file.

yes indeed.

> The concept of cue point injection would be its also a part of the
> metadata hence it would be stored into the buffer along with the other
> metadata information got from the file. hence while writing the output
> file this would be appended to the data to be written.

for what I understand (stop me if i'm wrong), cue points can be
located either as part of the onMetadata tag, all together in an
array, or as onCuePoint tags scattered in the file, at the appropriate
timestamps.

Therefore, a specific way must be chosen.

I recommend you to read the official adobe specs anyways, in order to
fully understand FLV and AMF0:
http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf
http://opensource.adobe.com/wiki/download/attachments/1114283/amf0_spec_121207.pdf

> What you are saying is the case when there is already metadata present
> in the flv. Lets assume we have a raw file or flv with no metadata.
> would this not make things simple i.e no issue of offset errors?

Actually, you need to:
1) create all desired metadata objects in memory
2) compute metadata size
3) modify metadata offsets and file size information to take its size
into account
4) finally write the output flv

the presence or not of initial metadata does not change anything.
Take a look at http://code.google.com/p/flvmeta/source/browse/trunk/src/info.c#654
to see how placeholder values are modified once the data size is
known.

> I have exposure to tinyxml++  .

flvmeta is written in portable ANSI C, so I will not release code
using or linked to C++ libraries.
This I why I plan to use expat, even though my personal preference
goes to tinyxml.

> lets say we get the cue point data
> from the xml file  and store them in buffers. the actual file which
> writes the data into flv is in the update.c right?
> /*
>     Write the flv output file
> */
> from line 722 onwards.
> so we would have to add code to write the cue point data here ?.

You'll need to modify metadata beforehand, in the info.c file
(compute_metadata function http://code.google.com/p/flvmeta/source/browse/trunk/src/info.c#516),
and then write it in update.c, if you intend to use the "--update"
command in order to insert metadata from an external file.

> I use codebocks and windows xp and i am still trying to figure out how
> to get the source to compile using the cmake .i would appreciate any
> help ( instructions ) regarding this . I have read in the news " Added
> support for CMake builds in addition to autotools. It is now the
> official way to build flvmeta on Windows. " . any where i can find
> more detailed instructions on this?

I recommend you to download and install CMake from the www.cmake.org
website.
It comes with a nice GUI that allows you to open CMakeLists.txt files,
and create a build folder.
You can then choose an IDE/compiler target environment, including
Codeblocks/MinGW.
Alternatively, you can use CMake from the command line like this :

$ md build
$ cd build
$ cmake .. -G "CodeBlocks - MinGW Makefiles"

and open the generated project in codeblocks.

> Are there any external dependencies that affect flvmeta?

no, every dependancy is bundled with flvmeta, it should be easy to
build it.

>
> Thanks

You're welcome :)
Reply all
Reply to author
Forward
0 new messages