Menu

#95 mp3splt - tags - merging

closed
nobody
None
1
2013-02-07
2013-02-03
No

It looks like when I set id3 tags with libmp3splt, they replace the existing tags. However when I want to only replace certain tags, it doesn't seem possible.
So, if possible I'd like a feature that can merge existing tags with new tags, or overwrite existing tags. Or am I wrong and am I missing an api?

Discussion

  • Munteanu Alexandru

    It depends what you call 'existing tags'. If you are talking about the input file existing tags, for the moment the only way to replace some tags is to use the mp3splt_put_tags_from_string with something like %[@o,@a=replaced_artist]; more info in the mp3splt manual - look at the -g option. But this is not very convenient to use.
    Probably the best would be to introduce an option to get the original tags so that when using mp3splt_append_tags it will replace the original tags if set.

    If you call 'existing tags' the tags extracted from a CUE file, it's a different issue.

    Besides, there are different issues if you want to set tags on each track that will be split or for example set the artist and the album for all tracks; it depends what exactly you want to set.

     
  • Hans Oesterholt-Dijkema

    Thank you for your answer. The use case I have is as follows:

    • I have album art (COVER_FRONT) in the original mp3 file.
    • I read my cuesheet with all the track information like title, performer, album title, album performer, rem genre, etc.
    • I split out the segment I want with mp3splt (memory mode, it works great).
    • I present this segment as a .mp3 file in my fuse filesystem (iTunes believes it deals with mp3 tracks :-).
    • However, on generating the mp3 segment and setting the info from the cuesheet, the original tags are lost and also the embedded album art.

    You can look at what I'm doing at:

    https://github.com/hoesterholt/cue_fuse/blob/master/src/segmenter.c

     
  • Munteanu Alexandru

    I have modified the latest development version to include the following:
    1) Option to set the original tags SPLT_TAGS_ORIGINAL:
    mp3splt_tags_set(state, SPLT_TAGS_ORIGINAL, "true", NULL);
    - please note that in order for this to work, you also need to call:
    mp3splt_read_original_tags(state);
    after having set the input file to be split

    2) Option to keep the original tags when parsing a CUE or CDDB file:
    mp3splt_set_int_option(state, SPLT_OPT_CUE_CDDB_ADD_TAGS_WITH_KEEP_ORIGINAL_TAGS, SPLT_TRUE);

    I saw that you are parsing CUE file.
    libmp3splt has included support for parsing CUE files.
    You could try using mp3splt_import if you wish, with the newly added option as described in 2).

    Please let me know if you need a snapshot like the last time.

    Modifications:
    https://sourceforge.net/p/mp3splt/code/1255/

     
  • Hans Oesterholt-Dijkema

    I would welcome a snapshot!

     
  • Munteanu Alexandru

     
  • Hans Oesterholt-Dijkema

    This is the output.

    $~/software/cue_fuse/src$ mp3info /tmp/10cc.mp3
    File: /tmp/10cc.mp3
    Title: Bloody Tourists Track:
    Artist: 10cc
    Album: Year: 1978
    Comment: Genre: [255]

    $~/software/cue_fuse/src$ mp3info /tmp/10cca.mp3
    /tmp/10cca.mp3 does not have an ID3 1.x tag.

    $~/software/cue_fuse/src$

    I seem to have lost all id3 tag info.

     
  • Munteanu Alexandru

    It works for me with this:
    http://ioalex.net/testing_downloads/minimal.c
    You can compile it
    gcc -g -Wall minimal.c $CFLAGS -o minimal $LDFLAGS -lmp3splt
    and try.

    Strange enough.

    Try recompiling by removing the following line
    mp3splt_free_one_tag(tags);
    from libmp3splt/src/mp3splt.c. Maybe I have introduced a regression when I tried to fix a memory leak ?

    When you compile libmp3splt, it tells you if it has found libid3tag, but when you run it, it does not complain about not finding it, because it also supports ID3v1 without libid3tag.

     
  • Hans Oesterholt-Dijkema

    I don't know what I'm doing wrong. This is my minimal output

    $:~/software/cue_fuse/src$ make minimal
    cc -c -I../elementals -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -I/usr/local/include minimal.c
    minimal.c: In functie ‘print_message_from_library’:
    minimal.c:85:5: let op: formaat is geen stringconstante en er zijn geen formaat-argumenten [-Wformat-security]
    minimal.c:90:3: let op: formaat is geen stringconstante en er zijn geen formaat-argumenten [-Wformat-security]
    cc -o minimal minimal.o -pthread -lfuse -lrt -ldl -L/usr/local/lib -lmp3splt -L../elementals -lelementals
    $:~/software/cue_fuse/src$ ./minimal
    ./minimal: error while loading shared libraries: libmp3splt.so.0: cannot open shared object file: No such file or directory
    $:~/software/cue_fuse/src$ LD_LIBRARY_PATH=/usr/local/lib ./minimal
    Please provide the input file to be split as the first argument.
    $:~/software/cue_fuse/src$ LD_LIBRARY_PATH=/usr/local/lib ./minimal /tmp/10cc.mp3
    info: file matches the plugin 'mp3 (libmad)'
    info: found Xing or Info header. Switching to frame mode...
    info: MPEG 1 Layer 3 - 44100 Hz - Stereo - FRAME MODE - Total time: 49m.57s
    info: starting normal split
    /tmp/10cc_00m_00s01m_00s.mp3 created.
    Processed 2298 frames - Sync errors: 0
    file split
    $:~/software/cue_fuse/src$ ls -l /tmp/10cc_00m_00s
    01m_00s.mp3
    -rw-rw-r-- 1 hans hans 2401174 feb 5 10:20 /tmp/10cc_00m_00s01m_00s.mp3
    $:~/software/cue_fuse/src$ mp3info /tmp/10cc_00m_00s
    01m_00s.mp3
    /tmp/10cc_00m_00s__01m_00s.mp3 does not have an ID3 1.x tag.

    $:~/software/cue_fuse/src$ ls -l /tmp/10cc*
    -rw-rw-r-- 1 hans hans 2401174 feb 5 10:20 /tmp/10cc_00m_00s__01m_00s.mp3
    -rw-rw-r-- 1 hans hans 2403265 feb 5 09:50 /tmp/10cca.mp3
    -rwxr--r-- 1 hans hans 120709953 feb 5 09:50 /tmp/10cc.mp3
    $:~/software/cue_fuse/src$
    $:~/software/cue_fuse/src$ mp3info /tmp/10cc.mp3
    File: /tmp/10cc.mp3
    Title: Bloody Tourists Track:
    Artist: 10cc
    Album: Year: 1978
    Comment: Genre: [255]

     
  • Hans Oesterholt-Dijkema

    I removed mp3splt_free_one_tag(tags);
    It didn't help :-(

     
  • Hans Oesterholt-Dijkema

    BTW, when I removed libid3tag0-dev from my system, make clean, and reconfigured libmp3splt (./configure --prefix=/usr/local), it warned, next I did 'make', it resulted in an compile error. (some datatype missing).

    mp3.c:37:42: error: unknown type name 'tag_bytes_and_size'
    mp3.c:38:1: error: unknown type name 'tag_bytes_and_size'
    mp3.c:39:56: error: unknown type name 'tag_bytes_and_size'

     
  • Munteanu Alexandru

    Hmm. Looks like there is a mess with different libmp3splt versions, CFLAGS, LDFLAGS or something else :(

     
  • Munteanu Alexandru

    The compilation should be fine with the .tar.gz I have provided you, since I have managed to build binaries yesterday.

     
  • Hans Oesterholt-Dijkema

    This is the log:

     
  • Hans Oesterholt-Dijkema

    Excuse me, I didn't use your offered minimal.c, but the one with the library distribution. Your offered minimal.c for testing worked. However, I think I've found the source of the problem. When going over to 'pretend' mode and using the callback function for writing, a valid mp3 file is written (of 1 minute long), but no id3vX info.

     
  • Hans Oesterholt-Dijkema

    Ok, with this 'minimal.c' (attachement), I get this output:

    hans@localhost:~/software/cue_fuse/src$ !LD
    LD_LIBRARY_PATH=/usr/local/lib ./minimal /tmp/10cc.mp3 a
    Pretend - /tmp/test.mp3
    info: file matches the plugin 'mp3 (libmad)'
    info: found Xing or Info header. Switching to frame mode...
    info: MPEG 1 Layer 3 - 44100 Hz - Stereo - FRAME MODE - Total time: 54m.18s
    info: starting normal split
    /tmp/10cc_01m_00s__02m_00s.mp3 created.
    Processed 4595 frames - Sync errors: 0
    file split
    /tmp/test.mp3 created!
    hans@localhost:~/software/cue_fuse/src$ LD_LIBRARY_PATH=/usr/local/lib ./minimal /tmp/10cc.mp3
    Normal - /tmp/test1.mp3
    info: file matches the plugin 'mp3 (libmad)'
    info: found Xing or Info header. Switching to frame mode...
    info: MPEG 1 Layer 3 - 44100 Hz - Stereo - FRAME MODE - Total time: 54m.18s
    info: starting normal split
    /tmp/test1.mp3 created.
    Processed 4595 frames - Sync errors: 0
    file split
    hans@localhost:~/software/cue_fuse/src$ mp3info /tmp/test.mp3
    /tmp/test.mp3 does not have an ID3 1.x tag.

    hans@localhost:~/software/cue_fuse/src$ mp3info /tmp/test1.mp3
    File: /tmp/test1.mp3
    Title: custom_title Track: 1
    Artist: Sade
    Album: Year: 1985
    Comment: Genre: Pop [13]

    hans@localhost:~/software/cue_fuse/src$ ls -l /tmp/test*.mp3
    -rw-rw-r-- 1 hans hans 1775850 feb 5 18:13 /tmp/test1.mp3
    -rw-rw-r-- 1 hans hans 1775722 feb 5 18:13 /tmp/test.mp3
    hans@localhost:~/software/cue_fuse/src$

     
  • Munteanu Alexandru

    There is indeed a bug with ID3v1.
    I am fixing it ...

     
  • Munteanu Alexandru

    This issue should be fixed:
    http://ioalex.net/testing_downloads/snapshots/1258/

    I recommend you to use another ID3 reader that supports both ID3v1 and ID3v2.
    mp3info is ID3v1 only.
    I use eyeD3 with "eyeD3 -1 file.mp3" or "eyeD3 -2 file.mp3".

     
  • Hans Oesterholt-Dijkema

    It works! Thanks a great deal!

     
  • Munteanu Alexandru

    I consider this issue fixed.
    I am closing the ticket for now.
    Please post here if still necessary.

     
  • Munteanu Alexandru

    • status: open --> closed