Modify function djinfo ($ dir) for obtaining mp3 file information using php)
{
If (! File_exists ($ dir) return '';
If (substr (php_uname ('s '),) = "Windows") {// not supported by LINUX
$ Player = new COM ("WMPlayer. OCX ");
$ Media = $ player-> newMedia ($ dir );
$ Time = $ media-> duration; // Obtain the duration
@ $ S_bitrate = $ media-> getItemInfo (Bitrate); // get the bit rate
@ $ Size = $ media-> getItemInfo (FileSize); // size
$ Time = sprintf ("% 01.0f", $ time );
$ S_duration = strftime ("% H: % M: % S seconds", $ time-28800 );
$ S_bitrate = str_replace (substr ($ s_bitrate,-3), "", $ s_bitrate). "Kbps ";
$ S_size = $ this-> formatsize ($ size );
Ob_flush (); flush ();
Return $ s_size. '|'. $ s_bitrate. '|'. $ s_duration;
} Else {
Return '';
}
}
The original code is like this. for example, if the original acquisition time is 01:08:05, you want to change it to 68 minutes and 05 seconds.
How can you change it? thank you.
Reply to discussion (solution)
Thank you for your help.
Do you want to edit mp3 files? According to Microsoft's definition, media should only read data and cannot modify mp3 files?
Https://msdn.microsoft.com/en-us/library/windows/desktop/dd563869 (v = vs.85). aspx #
Bitrate and FileSize isReadOnlyItem are both true, filesize definition page: https://msdn.microsoft.com/en-us/library/windows/desktop/dd562991 (v = vs.85). aspx
In this case, it is better to directly ask vb and other developers whether they can use WMPlayer. OCX to change files?
I want to convert the image to 68 minutes and 05 seconds after 01:08:05, instead of modifying the MP3 file.
So it's just a matter of time display?
$ Media-> duration results in seconds, so it is $ time/60 minutes, $ time % 60 seconds. what is the result?
So it's just a matter of time display?
$ Media-> duration results in seconds, so it is $ time/60 minutes, $ time % 60 seconds. what is the result?
$ Time = 4085;
Echo sprintf ("% dmin, % 02 dsec", floor ($ time/60), $ time % 60 );
This feeling
$ Time = $ time-28800; $ s_duration = date ('H', $ time) * 60 + date ('I', $ time ). date ("minute second", $ time); echo $ s_duration;
68 minutes 05 seconds
Thank you!