Jump to content

Recommended Posts

hi!

 

yet more problems and questions-i am trying to read ogg metadata

 

by opening the file and looking for the tag data, i can manage to echo out the vorbis header, but the commend fields wont echo out, i get random characters-buti can see the data in the file (with a hex editor)

 

hexeditpp1.jpg

 

whe i try and read the data for album name

 

using fread($file,x) ;

 

and echo it out, its not equal to the album name?

 

anyone have any suggestions!

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/51560-reading-file-data/
Share on other sites

Hmm, I don't think it's an encoding issue, it looks more like a file pointer issue because your output seems to be coming from the 104 line of your hex output instead of the 82 line that you are trying to read.. What happens if you don't do a fseek? Does it seem to start from the beginning of the file? If so, then you might just need to adjust the fseek.. I'm not too familiar with reading binary files, so maybe someone else will have some suggestions if that doesn't help..

 

Link to comment
https://forums.phpfreaks.com/topic/51560-reading-file-data/#findComment-253948
Share on other sites

thing is if i do echo file_get_contents(file.ogg)

 

i see the data i am trying to extract?!which must mean it can be echoed out?

 

 

OggS���������Ý¢����!)‚evorbis����D¬������q�����¸OggS����������Ý¢���® ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿvorbis���Xiph.Org libVorbis I 20020717������Album=avvvv���Artist=avril���Comment=aaa���Genre=Alt. Rock���Title=girlfriend ���Tracknumber=2 ���Date=2808vorbis)BCV����1L(Ä€ÐU����

Link to comment
https://forums.phpfreaks.com/topic/51560-reading-file-data/#findComment-253975
Share on other sites

Very strange that file_get_contents() shows the correct data but fread() doesn't.. I would just use whatever works, maybe something like this:

 

$data = file_get_contents(file.ogg);

$album = substr($data, 150, 30);

echo $album;

 

That should accomplish the same thing that you were trying to do with fread()?

 

Link to comment
https://forums.phpfreaks.com/topic/51560-reading-file-data/#findComment-254001
Share on other sites

yep made no sense to me mate

 

phast1,

 

the thing is it seems that with the file it varies i.e say album was a max of 32 bytes it could only be 2 and is seperated by

 

 

ascii code 11

so i.e. Name 0 0 11 Album

 

obviously the 0 are NULL and the 11 is well i think  | ? woukld the best way to do this to be to read say 100 bytes of the file in, then look for this seperator and each time split it based on this?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/51560-reading-file-data/#findComment-254128
Share on other sites

It looks like ASCII 11 is a vertical tab according to http://www.asciitable.com/ .. And yeah, your editor is most likely using the pipe symbol (|) just to represent the vertical tab.. I wouldn't worry too much about the character being represented though, just do the test for ASCII char 11, such as:

 

if ($var == chr(11))

 

 

Link to comment
https://forums.phpfreaks.com/topic/51560-reading-file-data/#findComment-254650
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.