Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • P PyAV
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 37
    • Issues 37
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 26
    • Merge requests 26
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyAV
  • PyAV
  • Issues
  • #59
Closed
Open
Issue created Oct 16, 2014 by Administrator@rootContributor

Problems with international characters in metadata

Created by: jfhs

I've built PyAV for python 3, and it works fine, except that it fails on reading metadata from files, if they contain unicode/international (I'm not sure) characters. I.e. I had file with title for audio channel with russian letters, and got exception:

"UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)"

I fixed that by changing the avdict_to_dict so that it returns bytebuffers instead of strings as values:

cdef dict avdict_to_dict(lib.AVDictionary *input):

    cdef lib.AVDictionaryEntry *element = NULL
    cdef dict output = {}
    cdef bytes value
    while True:
        element = lib.av_dict_get(input, "", element, lib.AV_DICT_IGNORE_SUFFIX)
        if element == NULL:
            break
        value = element.value
        output[element.key] = value
    return output

Maybe you'll find some other, more nicer way, but I'm not sure if there is a way to determine right encoding.

Assignee
Assign to
Time tracking