www.mediacollege.com | Support Forum
MC Media Player

Actarus flv dump test: Benchmarking the getID3 library (Update 4)

As I posted to Zathras here, we can use the id3tag library php and apdapt it to retrieve information of flv. After playing a bit with it..I finally got results and I sumarized it as a table. I tooked for this benchmarking my video test files just to see if the getId3 lib can follow the stream of codecs. Before I comment the results, I want to thanks the getID3 author here for his code who was very intuitive and well pluged. This saved me a lot of time and worries to adapt the osfvplayer code who was lacking of the riff support. simply by guessing only two or three files needed to be added in the same directory to make it work!

History / Updates:

22.01.2011: I tooked the time to benchmark the getID3 library.

I wanted to know if size and more can be extracted to configure the player. Results are very promising but this depends on the codec and for flv/h264 tagging the video is THE SOLUTION.
See by yourself. I have just discovered a cool ffmpeg bridge for php: ffmpeg-php to retrieve videos infos as well!

27.01.2011: I discovered yamdi and of course added to my hall of fame for FLV injectors. Without any doubts, this is the coolest FLV injector of the world: two reasons, it has a better tag injection as we will see and it's opensource. Well done Ingo Oppermann! I have however two requests:

  • the custom injection directly from xml file.. Why? for completing missing tags and setting own record signatures like G00gle does (flvmdi is the only tool that open the door thanks to xtradata).No more the one, a patch allows this! Sorry ladies and gentlemen, it ignores the tags too :(..
  • ID3 tags support for mp3 audio directly in flv. Why will be like a jump to sky to port this feature using the ID3 support from getID3...Of course at the end, it's the Heaven if all is inegrated in getID3!
I have also tried to install the perl tool flv-Info but without luck..cpan installation loops due to a broken installation script (Exception::Class), work of Chris Dolan can not be tested.

28.01.2011: flv h264/mp3 tag issue solved! GetID3 read correctly ID3 tags stored in mp3 audio of flv if you use the latest ffmpeg

03.02.2011: I have built a dummy thumb generation using my flvinfo library. I have made usage of this to show nice thumbs according to the file properties in the *new* flvdump page updated today. This will be extended in my playlist too when thumbs will be handled into tubes config files. For those who want no to create thumbs by hand from images extracted previously from videos, there is phpthumbs.

07.02.2011: I decided to uniformize id3 tags between mp3 and flv, now it's easy to get any id3 tag thanks to the new getid3info() function \O_O/, see here. Moreover, I fixed the broken FLV1/H263 codec detection in getID3 since my yesterday discovery: my advice for flv1 generation (if you need to inject tags behind with flvtool2) is to avoid avidemux that does not generate correct sorenson spark (codec is good but the flv header is missing!). Use ffmpeg instead but I warn you, the id3 tag injection is broken (I lost my afternoon trying to inject id3tags ^^'). All this candies have been wrapped in the major release flvinfo-2.0.

09.02.2011: New flvinfo-2.1 ! Please stay stuned because I am forking flv4php ^^ and it's core is not a piece of cake at all. Of course, it will use flvinfo core for a better tag injection/detection in the metadata and integrate flvcuepoints. I played a bit with RichFLV which opens the cut feature of flvtool2 to the H264 world :). The bad news for videos keyframes declared in the metadata, is that no tool agree each other on their values, whose calculation is right, I am really wondering now. I've finally succeeded to inject ID3 tags into H263 with FLVTool2 since yesterday, I will explain all this as soon as possible.

16.02.2011: Two days means two new packages, doesn't it? Yes, I released the new flvinfo-3.0 that ends truely the fight with the h263/flv detection and improves riff support so you can know now if the video was produced by virtualdub =).

Overview

The table below vaults thousands of words. Indeed, it puts in light the fact that except dave's promo video and my h264 encoded files, file header is RIFF. This is surely the explanation why other vp6 codecs are not playable , ie recognized by mc media player. What we can notice too is that detection support for h264 video is seriously lacking in GetId3 php4(The h264 value comes in fact from my patch and video size is incorrect unless you tag the file). This may be not the case in the php5 version more up-to-date if you update module.audio-video.flv.php of OSFlvPlayer_v4.2 with latest getID3's one,video's size is now read correctly but not video's rate. The VP62 codec Dave has used for his promo (assuming GSPOT output is ok) is seen incorrectly as On2 VP6. This means getID3 takes video's name for the codec's name [EDIT:I've patched the codec names to fix this]. All is not shown as it's very detailed, I kept only the most important things.We can notice that yamdi's values slightly differ for rates and video's sampling: I don't know but it seems to be that a bit, has escaped from yamdi's mask code!

namesizedurationheaderwidthheightcodecratemodesamplingtags
video
audiovideo
audiovideo
audiovideo
audiovideo
audio
goldorak_h264_tagged_id3_reinjected_updated_by_yamdi.flv13.61 MB1:02flv320240Sorenson H.264(H264)MPEG Layer-3 (MP3)1.63 KB/s125.14??25.0544100Array(25)Array(0)
goldorak_h264_tagged_custom_flv4php4.flv3.51 MB1:02flv320240Sorenson H.264(H264)MPEG Layer-3 (MP3)1.67 KB/s125.00??25.0044100Array(40)Array(10)
goldorak_h264_tagged_id3_reinjected.flv13.61 MB1:02flv320240Sorenson H.264(H264)MPEG Layer-3 (MP3)1.67 KB/s125.00??25.0044100Array(25)Array(0)
goldorak_h264_tagged_id3.mp3971.85 KB1:02mp3MPEG Layer-3 (MP3)125.00cbr44100Array(0)Array(11)
goldorak_h264_tagged_id3.flv13.61 MB1:02flv320240Sorenson H.264(H264)MPEG Layer-3 (MP3)1.67 KB/s125.00??25.0044100Array(22)Array(10)
goldorak_h264_tagged.flv13.61 MB1:02flv320240Sorenson H.264(H264)MPEG Layer-3 (MP3)1.67 KB/s125.00??25.0044100Array(25)Array(0)
mario.flv3.56 MB1:02flv400300Sorenson Spark(FLV1)MPEG Layer-3 (MP3)413.15 B/s56.45??25.0022050Array(35)Array(7)
test.flv153.69 KB-1:48flv320240Sorenson Spark(FLV1)Linear PCM(PCM#platform endian)287.05 B/s0.00????Array(19)Array(0)
goldorak_sorenson_spark_avidemux.flv11.41 MB1:02riff352288Sorenson H.263(H263)MPEG Layer-3 (MP3)1.34 MB/s125.00vbrcbr25.0044100Array(25)Array(0)
goldorak_h263_avidemux.flv8.25 MB1:02riff352288Sorenson H.263(H263)MPEG Layer-3 (MP3)956.25 KB/s125.00vbrcbr25.0044100Array(25)Array(0)
goldorak_flv_ffmpeg.flv2.97 MB1:02flv352288Sorenson Spark(FLV1)MPEG Layer-3 (MP3)195.31 B/s125.00??25.0044100Array(13)Array(0)
goldorak_h263_ffmpeg.flv3.01 MB1:02riff352288Sorenson H.263(H263)MPEG Layer-3 (MP3)262.74 KB/s125.00vbrcbr25.0044100Array(25)Array(0)
goldorak_h264.flv13.61 MB1:02flv320240Sorenson H.264(H264)MPEG Layer-3 (MP3)1.67 KB/s125.00??25.0044100Array(13)Array(0)
goldorak_vp60.flv12.61 MB1:02riff320240On2 VP60(VP60)MPEG Layer-3 (MP3)1.49 MB/s125.00vbrcbr25.0044100Array(25)Array(0)
goldorak_vp61.flv10.37 MB1:02riff320240On2 VP61(VP61)MPEG Layer-3 (MP3)1.21 MB/s125.00vbrcbr25.0044100Array(25)Array(0)
MCMP_Promo.flv1.3 MB0:30flv480270On2 VP6(VP62)MPEG Layer-3 (MP3)300.00 B/s40.00??25.0022050Array(11)Array(0)
goldorak_vp70.flv3.4 MB1:02riff320240On2 VP70(VP70)MPEG Layer-3 (MP3)316.65 KB/s125.00vbrcbr25.0044100Array(25)Array(0)
goldorak_vp80.flv3.22 MB1:02riff320240Google VP8 Video(WebM)MPEG Layer-3 (MP3)292.89 KB/s125.00vbrcbr25.0044100Array(25)Array(0)

All this table was generated dynamically from a code like this:
include "lib/flash.php" ; //from OSFlvPlayer_v4.2, with module.audio.mp3.php, module.audio-video.riff.php from getid3 (static word cleaned)
include "lib/flvinfo.php" ; //my addon (see at the end of this file)
include "lib/table.php" ; //for the output

//Directory of your flv files
$tubes='abc/def/';

$flvs=array(
  'goldorak_h264_tagged_id3_reinjected.flv',//first one is important as all the column names depends on it, I use the tagged one on both audio and video sides
  'goldorak_h264_tagged.flv', 'goldorak_flv1.flv',
  'goldorak_h264.flv',
  ....
  'goldorak_vp80.flv'

);
$fMax=count($flvs);
$infos=array();
$subarray_values=array();
for($f=0;$f<$fMax;$f++) {
  $movie=$flvs[$f];
  $flv=$tubes.$movie;
  $info=getflvinfo($flv); //here is the main function of the addon
  $infos[]=$info; //Optional, store the results for the next usage (meta info)
  $info=$info["overview"]; //Overview only please
  $header=($f==0) ? 1 : 0;//Use the first row data, ie first flv file as reference header for column names
  html_show_array($info,$subarray_values,$header,0,15); //show only the first 14 columns because the table is too large for the screen..
}

Tags

Tags allow to store extra informations of the file. For example, jpeg extra informations (author, size...) are saved in the exif header.This is very usefull when you got a lot of pictures and want to set copyrights and establish categories. For flash videos with the flv header, as we will see below in the table, all technical video settings is encoded in a info table.
I managed to dump major part of it thanks to the flv module of the getID3 Library. I have made an adapter to complete the table, because the riff format doesn't have the same properties names and my wish, as I said previously, was to compare the videos files. In red, the problems I encountered while trying to make order in the table and sometimes, I didn't manage to find equivalent to complete the data mining-hunt game.

Video
this is stored in the meta info. This is normaly filled when flv files are tagged but I discovered that wfw264 do this partially maybe there is an option x264.exe to complete this.The complete name of the injector for flvmdi, I used to complete the injection is shown and leads to a much more complete meta table if we compare it with the table of Dave's promo video excepting the tag creationdate but there is an equivalent, it's metadatadate. Maybe flvtool2 would perform this better and handles tagging riff files as well, not sure.[EDIT: unusable, works only with VP62 & H263]. What's clear is uniformization need to be done between flv/riff world to be able to compare it. This is what I have made in this table by trying to find riff equivalents but the most important things are au rendez-vous: rates and sizes. We can complain about video codec ids that do not allow to integrate riff codecs. I will say this is at the image of the lack of documentation on this, surely one way decision to ensure the flv world is closed forever [EDIT:No more, here is the flv format thanks to osflash.org....GREAT WIKI AND TOOLS THERE!]
What's the blinking text for? This is to show my success in injecting custom tags (at least!) thanks to a patched version of flv4php I have built. Let's celebrate this in colors ! I have recently added the test.flv used in the Fanno's tutorial to produce flv thumbs because I didn't manage to make it work on my side and I wanted to know why. It showed clearly that duration tag has a problem with its negative value and we can wonder now what's is the right naming for the has... tags! If everyone decides on its own to uppercase some letters or not (this is not to throw the stone to Fanno naming that is respecting the all in lowercase style that yamdi started to broke), we will soon got the jungle tag soup. Hey guys, in fact I don't mind who is right, but meet each other to synchronise your tag names please before it's too late and we got definitely lost...

video
fileprops
(thumb
for this
virtual tag)
metadata

creator
has
Key
frames
has
Video
has
Audio
has
Meta
data
can
Seek
To
End
durationdata
size
video

size
frame
rate
video
data
rate
video
codec
id
widthheightaudio

size
audio
data
rate
audio
codec
id
audio
sample
rate
audio
sample
size
stereofile
size
last
time
stamp
lastkey
frame
time
stamp
lastkey
frame
location
key
frames
audio
delay
encodercreation
date
metadata

date
xtra
data
albumartistalbum_artistcomposerdiscyeargenretitletrackcomments
creator
has
key
frames
has
metadata
cuePointshas
CuePoints
flv H264 with YAMDIYet Another Metadata Injector for FLV - Version 1.71111162.04142706111323367425.048355899421664.3273202401021217125.1423111427176462.0462.0414271744Array(29)                    
flv H264 with FLV4PHPFLV Editor for PHP V0.21a (Project: Flv4php)+111+62.16++251706.197320240+125.0024410016114270786+++++Lavf52.83.0+1296427234000++++++++++ Goldorak's injector!    
flv H264 with FLVMDIManitu Group FLV MetaData Injector 2    162.128120213239890251706.1973202401030721125.002441001611427182662.0462.04 Array(29)0Lavf52.83.0unknown1295695234796karaoke by Actarus               
mp3 MP3 with MP3TAG                                             
flv H264 with FFMPEG      62.16  251706.197320240 125.0024410016114271137     Lavf52.93.0   UFO Robot GrendizerActarusShunsuke KikuchiShunsuke Kikuchi11978AnimeLa légende d'Actarus/Legend of Actarus0      
flv H264 with FLVMDIManitu Group FLV MetaData Injector 2    162.115119313239890251706.1973202401030577125.002441001611427167362.0462.04 Array(29)0Lavf52.83.0unknown1295432143295by actarus               
flv FLV1 with FLVTOOL2inlet media FLVTool2 v1.0.6 - http://www.inlet-media.de/flvtool2111161.923718720321272825413.15240030046278656.45222000160373501361.8861.52 Array(144)0  1297170710609 Super Lego MarioMario   2011GameHigh scores1Score to beat:123456789 by Actarus   Array(144)1
flv FLV1 with FLV4PHPFLV Editor for PHP V0.21 (Project: Flv4php)     -12.179571156799 287.05 32024000.000   157379-12.17946717305327Array(1)   1296539613000           FLV Editor for PHP V0.21 (Project: Flv4php)11  
riff H263    62.0811904746251406116.75?352288125.002441000111962722                
riff H263    62.08859191025979204.90?352288125.00244100018649886                
flv FLV1 with FFMPEG      62.08  25195.312352288 125.002441001613114554     Lavf52.93.0                  
riff H263 with FFMPEG    62.08308111225269050.52?352288125.00244100013153758 Lavf52.93.0               
flv H264 with FFMPEG      62.16  251706.197320240 125.0024410016114270786     Lavf52.83.0                  
riff VP60    62.0813157850251567599.23?320240125.002441000113217578                
riff VP61 with VDUB    62.0810807606251264732.73?320240125.002441000110868736 VirtualDubMod 1.5.10.2 (build 2542/release)               
flv VP62     129.96  25300.004480270 40.002        0 Wed Aug 13 18:01:40 2008                  
riff VP70 with VDUB    62.08350944825324248.45?320240125.00244100013569664 VirtualDubMod 1.5.10.2 (build 2542/release)               
riff WebM with VDUB    62.08332063225299916.49?320240125.00244100013381248 VirtualDubMod 1.5.10.2 (build 2542/release)               

Here is the code to produce this table:
  	//dump the meta info columns
	$subarray_tags=array();
	
	//Generate the header taking the first video as reference
	$info=$infos[0]["overview"];

	$infos_tags=$info["tags"];
	
	//==== Complete the missing tags columns ====
	//Virtual tag, inject the file name to know which video we are referring to
	array_unshift($infos_tags["video"], "name <br><br>(virtual tag to see which video we are referring to!)");
	//----extra tag from flvmdi
	$infos_tags["video"]["audiodelay"]=true;
	//---extra tag from ffmpeg/FLVTool2(video)
	$infos_tags["video"]["encoder"]=true;
	//---extra tag from Dave's on VP62 encoder
	$infos_tags["video"]["creationdate"]=true;
	//---extra tag from flvmdi/FLVTool2
	$infos_tags["video"]["metadatadate"]=true;
	//---extra custom tag from flvmdi
	$infos_tags["video"]["xtradata"]=true;
	//---extra tags from ffmpeg (audio/id3)
	$infos_tags["video"]["album"]=true;
	$infos_tags["video"]["artist"]=true;
	$infos_tags["video"]["album_artist"]=true;
	$infos_tags["video"]["composer"]=true;
	$infos_tags["video"]["disc"]=true;
	$infos_tags["video"]["year"]=true; //renamed, TYER for ffmpeg but year for mp3
	$infos_tags["video"]["genre"]=true;
	$infos_tags["video"]["title"]=true;
	$infos_tags["video"]["track"]=true;
	$infos_tags["video"]["comments"]=true;//added, this one was missing in ffmpeg but in mp3's ID3V2 
	//---extra custom tag from flv4php/yamdi
	$infos_tags["video"]["creator"]=true;
	//---extra custom tag from FLVTool2 (cuepoint support)
	$infos_tags["video"]["cuePoints"]=true;
	$infos_tags["video"]["hasCuePoints"]=true;
	
	unset($infos_tags["audio"]);
	html_show_array($infos_tags,$subarray_tags,2); //2= generates only the header table

	
	$header=0;//0=generates only the row
	for($f=0;$f<$fMax;$f++) {
		$info=$infos[$f]["overview"];
		$infos_tags=$info["tags"];
		unset($infos_tags["audio"]); //delete audio tags
		array_unshift($infos_tags["video"], $info["name"]);
		if(array_key_exists("TYER",$infos_tags["video"])) { //Uniformize with mp3's getID3v2 more human readable
			$infos_tags["video"]["year"]=$infos_tags["video"]["TYER"];
			unset($infos_tags["video"]["TYER"]);
		}
		html_show_array($infos_tags,$subarray_tags,$header);
	}
	echo "\n";

You surely want to know how to inject custom tags with goldorak's injector, please check this before.

Audio
What's about the audio id3tag tag? Note that the id3 tags is only for mp3 encoded audio. As I didn't set any of these, I downloaded mp3tag. My first think was... could this soft, will be able to tag mp3 in flv directly? Answer is unfortunately not. You will have to extract the sound before as a mp3 track, then to tag it and remux using ffmpeg. Guess what? the meta info is lost during these demux/remux steps so you will have to reinject the videos tags to get the meta info back...but this is a neverending story as id3tags seems either to be washed by ffmpeg (surely an option somewhere) during muxing or id3 tags can not be read by getid3 inside the flv...pick your bug This was a ffmpeg version issue, windows available snapshot ffmpeg-r25512, (core Lavf52.83.0) was buggy but since I managed to compile from svn sources using cygwin-mingw, I tried today the ffmpeg r26402 (core Lavf52.93.0). However, ID3 tags do not appear in the meta audio section of getID3 as we could expect but ffmpeg (or getID3?) decides to put it in the video section, see previous table, the good news is no tag has been lost :) Here I have forced the mp3 as reference file to get the good columns , it is also the lonely file to be read correctly.No more, flvinfo-2.0 completes this.

audio
fileprops
(thumb
for this
virtual tag)
albumartistbandcommentscomposerpart_of_a_setencoder_settingsgenretitleyeartrack
flv H264 with YAMDI           
flv H264 with FLV4PHP+++ ++Lavf52.83.0++++
flv H264 with FLVMDI           
mp3 MP3 with MP3TAGUFO Robot GrendizerActarusShunsuke Kikuchiaka UFO Robot GrendizerShunsuke Kikuchi1Lavf52.83.0AnimeLa légende d'Actarus/Legend of Actarus1978
flv H264 with FFMPEGUFO Robot GrendizerActarusShunsuke Kikuchi Shunsuke Kikuchi1Lavf52.93.0AnimeLa légende d'Actarus/Legend of Actarus19780
flv H264 with FLVMDI           
flv FLV1 with FLVTOOL2Super Lego MarioMario Score to beat:123456789 by Actarus   GameHigh scores20111
flv FLV1 with FLV4PHP           
riff H263           
riff H263           
flv FLV1 with FFMPEG           
riff H263 with FFMPEG           
flv H264 with FFMPEG           
riff VP60           
riff VP61 with VDUB           
flv VP62           
riff VP70 with VDUB           
riff WebM with VDUB           

Again, here is the code to produce this table:
	//dump the meta info columns
	$subarray_tags=array();
	//Force the mp3 file as reference
	$info=$infos[3]["overview"];
	$infos_tags=$info["tags"];
	unset($infos_tags["video"]);
	//Vitual tag, inject the file name to know which video we referred to
	array_unshift($infos_tags["audio"], "name <br><br>(virtual tag to see which file we are referring to!)");
	html_show_array($infos_tags,$subarray_tags,2); //2= generates only the header table
	for($f=0;$f<$fMax;$f++) {
		$info=$infos[$f]["overview"];
		$infos_tags=$info["tags"];
		unset($infos_tags["video"]); //delete audio tags column as we want video tags only
		array_unshift($infos_tags["audio"], $info["name"]);	
		html_show_array($infos_tags,$subarray_tags,0); //0=generates only the row
	}
	echo "\n";

And now

It's time to draw conclusions of all of this. GetID3 is great, it allows us to chase the tags the encoder have set. The combination with the latest ffmpeg solved muxing issues (audio and tags). I am lazy to reinject tags with yamdi, the patch to populate extra tags simply do not fullfill his job, we will have to wait the future release of yamdi (wonder if getID3 has the write support now..) to be able to set creationdate by example. Now, iD3 tags can be shown with php and the wish of Zathras is exauced. Wait a minute, I looked in my crystal ball and I see a download section for those who want to play with me (to fix this) ;D