Skip to content

MP4 fails with string argument for freeform text ('----') tags #391

Open
@simonltwick

Description

@simonltwick

mutagen.mp4.MP4 container does not accept a string value for freeform
text tags, but expects (and returns) a bytes argument. This is
inconsistent with python3 default of string values.

code:

import mutagen.mp4.MP4 as MP4
m = MP4()
m['----:test:item'] = 'test value'
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3/dist-packages/mutagen/_file.py", line 75, in setitem
self.tags[key] = value
File "/usr/lib/python3/dist-packages/mutagen/mp4/init.py", line 375, in setitem
self._render(key, value)
File "/usr/lib/python3/dist-packages/mutagen/mp4/init.py", line 391, in _render
return render_func(self, key, value, *render_args)
File "/usr/lib/python3/dist-packages/mutagen/mp4/init.py", line 632, in __render_freeform
data += v
TypeError: can't concat str to bytes
m['----:test:item'] = b'test value'
m['----:test:item']
b'test value'

Expected behaviour: accept (and return) string values, with encoding
to utf-8 if required (this is implied in some of the comments in the
code).

Already submitted on Ubuntu Launchpad as https://bugs.launchpad.net/bugs/1835771, where I was advised to report it here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions