2

I need to dynamically create and send an id3 tag file content to a video stream from iOS.

For testing puspose I used the Apple id3taggenerator tool to create an hello.id3 file with a command like this :

id3taggenerator -o hello.id3 -title "Hello World"

From iOS I then read this file content and sent it to my video stream and everything worked fine. I printed this file content as a string and got this (that is, I suppose the id3 tag spec) :

(lldb) po text
"ID3\u{04}\0\0\0\0\0\u{17}TIT2\0\0\0\r\0\0\u{03}Hello World\0"

Now I would like to create this file content directly in code. I try with AVFoundation's AVMutableMetadataItem class but with no success (I didn't get the content description properly or I don't know how to get it).

let item = AVMutableMetadataItem()
item.keySpace = AVMetadataKeySpaceID3;
item.key = AVMetadataID3MetadataKeyTitleDescription as NSString
item.value = "Hello World" as NSString
// how can I get the item raw data ?

I also had a look to id3libiOS but was enable to make it work properly.

Anyone already did this ?

0 Answers0