Samurai016 / Audiotagger

This library allow you to read and write ID3 tags to MP3 files.
https://pub.dev/packages/audiotagger
MIT License
22 stars 20 forks source link

Error Trying To Write MetaData #9

Closed kreativeteksolutions closed 3 years ago

kreativeteksolutions commented 3 years ago

I am currently recording a live stream and writing it to a file in flutter using a byte array. I am doing this by reading the live stream as a stream and then writing it to a file using File.openWrite and all is going well however I just realized I need to write some metadata to the file. I tried doing the writeTag() but I keep running into this error:

However, I keep running into this error and have no idea how to fix this. Checking further because the ID3 Tag ends at 0x00 but the mp3 audio doesn't start until 0x129

This is also part of the error:

W/System.err(20398): java.lang.NullPointerException: Attempt to invoke interface method 'void org.jaudiotagger.tag.Tag.setField(org.jaudiotagger.tag.FieldKey, java.lang.String[])' on a null object reference
W/System.err(20398):    at com.nicolorebaioli.audiotagger.AudiotaggerPlugin$Util.setFieldIfExist(AudiotaggerPlugin.java:222)
W/System.err(20398):    at com.nicolorebaioli.audiotagger.AudiotaggerPlugin.writeTags(AudiotaggerPlugin.java:92)
W/System.err(20398):    at com.nicolorebaioli.audiotagger.AudiotaggerPlugin.onMethodCall(AudiotaggerPlugin.java:64)
W/System.err(20398):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
W/System.err(20398):    at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
W/System.err(20398):    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
W/System.err(20398):    at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(20398):    at android.os.MessageQueue.next(MessageQueue.java:326)
W/System.err(20398):    at android.os.Looper.loop(Looper.java:160)

Keep in mind this file that is being created has no metadata of any kind because it is a file that is created using the method described above. Hope to hear from someone soon!! Thank you in advance!

Samurai016 commented 3 years ago

I think the problem might be the file structure, especially the MP3 header. As I suggested in issue #7 , I would recommend you to:

Find the command to execute here. Let me know if it works!

kreativeteksolutions commented 3 years ago

I think the problem might be the file structure, especially the MP3 header. As I suggested in issue #7 , I would recommend you to:

  • Convert the file to mp3 using flutter_ffmpeg
  • Write tags using Audiotagger

Find the command to execute here. Let me know if it works!

Looks Like that did it thank you so much for steering me in the right direction! I will close this issue now! Once again thank you!