2006-12-20

FLV Metadata Injection: FLVTool2 & Flvmdi

若不是使用macromedia flash 8 encoder 的方式進行轉檔的話, 而是使用ffmpeg, mencoder等轉檔程式將影片轉成flv, 其轉出來的flv檔案通常metadata資訊是毀損的. 不過幸好目前有 FLVTool2 以及 Flvmdi 這兩套OpenSource工具, 可以協助幫忙修補其 Metadata

flvtool2
http://inlet-media.de/flvtool2

flvtool2 GUI
http://soenkerohde.com/software/flv-knife/

命令格式如下:
flvtool2.exe [-ACDPUVaciklnoprstvx]... [-key:value]... in-path|stdin [out-path|stdout]

如果out-path未定義, 則將覆蓋原來檔案. 如果指定in-path為目錄, out-path應為同目錄, 否則將會被忽略過

Commands:
-A Adds tags from -t tags-file
-C Cuts file using -i inpoint and -o outpoint
-D Debugs file (writes a lot to stdout)
-H Helpscreen will be shown
-P Prints out meta data to stdout
-U Updates FLV with an onMetaTag event

Switches:
-a Collapse space between cutted regions
-c Compatibility mode calculates some onMetaTag values different
-key:value Key-value-pair for onMetaData tag (overwrites generated values)
-i timestamp Inpoint for cut command in miliseconds
-k Keyframe mode slides onCuePoint(navigation) tags added by the
add command to nearest keyframe position
-l Logs FLV stream reading to stream.log in current directory
-n Number of tag to debug
-o timestamp Outpoint for cut command in miliseconds
-p Preserve mode only updates FLVs that have not been processed
before
-r Recursion for directory processing
-s Simulation mode never writes FLV data to out-path
-t path Tagfile (MetaTags written in XML)
-v Verbose mode
-x XML mode instead of YAML mode

在它官方的文件中, 最簡單的例子為
"C:\Program Files\flvtool2.exe" -UPx "C:\in.flv" "C:\out.flv"
執行將更新(修復) C:\in.flv文件的Metadata, 同時按照XML格式輸出Metadata訊息於螢幕上


FLVMDI (FLV Metadata Injector)
http://www.buraks.com/flvmdi/

http://buraks.com/flvmdi/ 提供GUI下載
http://www.buraks.com/flvmdi/ 本身也提供一個GUI

執行方法: flvmdi inputFile [outputFile][/s] [/x] [/e] [/k]

inputFile和outputFile可以是單一檔案或是目錄, 如果未指定輸出檔案或目錄, 則覆蓋原先的檔案

Switch:

[/s] 將執行結果以阿拉伯數字形式顯示, 如下:
Result String Result as One Character Meaning
Completed. 0 Sucess
An error occured. [filename] 1 Some error occured while processing, no details available.
usage: flvmdi inputFilename [outputFilename] [/s] [/x] [/k] [/eExtraData] 2 Error with parameters supplied
directory does not exist : [outputFolder] 3 The folder specified cannot be
found.

[/x] 將重新注入後的FLV Metadata到與該FLV檔案同層目錄底下同樣名稱的XML檔案中。

[/s] 給FLV檔案寫入附加字串DATA 。如果字串有空格, 則應將指令用雙引號引用, 如
给FLV文件写入附加字符串DATA。如果字符串有空格,则应将命令用双引号引用"/eThis is data with spaces"

[/k] 給FLV檔案添加keyframes, 如果文件本來就有keyframs, 將會被覆蓋。

沒有留言: