klv-parser


Nameklv-parser JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/paretech/klvdata/
SummaryA Python library for parsing MISB/STANAG 4609 Key Length Value (KLV) metadata.
upload_time2025-01-14 16:41:34
maintainerNone
docs_urlNone
authorPazshp
requires_python>=3.5
licenseMIT
keywords stanag 4609 misb klv metadata video
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            klv_parser
==========
.. image:: https://travis-ci.org/paretech/klvdata.svg?branch=master
    :target: https://travis-ci.org/paretech/klvdata

.. image:: https://coveralls.io/repos/github/paretech/klvdata/badge.svg?branch=master
    :target: https://coveralls.io/github/paretech/klvdata?branch=master

.. image:: https://img.shields.io/pypi/v/klvdata.svg
        :target: https://pypi.org/project/klvdata/

What?
-----
Klvdata is a Python library for parsing and constructing Key Length Value (KLV_) formatted binary streams. Common uses of the library would be parsing and displaying `MISB ST`_ 0601 Unmanned Air System (UAS) metadata from `STANAG 4609`_ compliant `MPEG-2 Transport Streams (TS) (MPEG-TS)`_. Note that klvdata alone cannot de-mux KLV data from an MPEG-2 TS, but programs like FFmpeg_ and GStreamer_ can be used with klvdata in the workflow to perform the function.

.. _KLV: https://en.wikipedia.org/wiki/KLV
.. _STANAG 4609: http://www.gwg.nga.mil/misb/docs/nato_docs/STANAG_4609_Ed3.pdf
.. _MPEG-2 Transport Streams (TS) (MPEG-TS): https://en.wikipedia.org/wiki/MPEG_transport_stream
.. _MISB ST: http://www.gwg.nga.mil/misb/st_pubs.html
.. _FFMpeg: https://www.ffmpeg.org/
.. _GStreamer: https://gstreamer.freedesktop.org/


Why?
----
Not many opensource options available.

Features
--------
- Parses KLV metadata streams.
- Supports `MISB ST`_ 0601 UAS Datalink Local Set.
- Supports `MISB ST`_ 0102 Security Metadata Local Set.
- Built for Python >= 3.5
- Requires no external Python dependencies.

.. _MISB ST: http://www.gwg.nga.mil/misb/st_pubs.html

Quick Start
-----------
Try these commands in your GNU/Linux terminal.

First:

.. code-block:: console

    $ pip3 install klvdata
    
    $ wget https://raw.githubusercontent.com/paretech/klvdata/master/data/DynamicConstantMISMMSPacketData.bin

    $ cat << EOF > klvdata_test.py
    #!/usr/bin/env python3
    import sys, klvdata;
    for packet in klvdata.StreamParser(sys.stdin.buffer.read()): packet.structure()
    EOF


And then:

.. code-block:: console

    $ python3 ./klvdata_test.py < DynamicConstantMISMMSPacketData.bin

        <class 'klvdata.misb0601.UASLocalMetadataSet'>
            <class 'klvdata.misb0601.PrecisionTimeStamp'>
            <class 'klvdata.misb0601.MissionID'>
            <class 'klvdata.misb0601.PlatformHeadingAngle'>
            <class 'klvdata.misb0601.PlatformPitchAngle'>
            <class 'klvdata.misb0601.PlatformRollAngle'>
            <class 'klvdata.misb0601.PlatformDesignation'>
            <class 'klvdata.misb0601.ImageSourceSensor'>
            <class 'klvdata.misb0601.ImageCoordinateSystem'>
            <class 'klvdata.misb0601.SensorLatitude'>
            <class 'klvdata.misb0601.SensorLongitude'>
            <class 'klvdata.misb0601.SensorTrueAltitude'>
            <class 'klvdata.misb0601.SensorHorizontalFieldOfView'>
            <class 'klvdata.misb0601.SensorVerticalFieldOfView'>
            <class 'klvdata.misb0601.SensorRelativeAzimuthAngle'>
            <class 'klvdata.misb0601.SensorRelativeElevationAngle'>
            <class 'klvdata.misb0601.SensorRelativeRollAngle'>
            <class 'klvdata.misb0601.SlantRange'>
            <class 'klvdata.misb0601.TargetWidth'>
            <class 'klvdata.misb0601.FrameCenterLatitude'>
            <class 'klvdata.misb0601.FrameCenterLongitude'>
            <class 'klvdata.misb0601.FrameCenterElevation'>
            <class 'klvdata.misb0102.SecurityLocalMetadataSet'>
                <class 'klvdata.misb0102.SecurityClassification'>
                <class 'klvdata.misb0102.UnknownElement'>
                <class 'klvdata.misb0102.UnknownElement'>
                <class 'klvdata.misb0102.UnknownElement'>
                <class 'klvdata.misb0102.UnknownElement'>
                <class 'klvdata.misb0102.UnknownElement'>
            <class 'klvdata.misb0601.UASLSVersionNumber'>
            <class 'klvdata.misb0601.UnknownElement'>
            <class 'klvdata.misb0601.Checksum'>

If you have FFmpeg installed and want to try it on real video from a drone with embedded KLV metadata (~97 MB Download):

.. code-block:: console

    $ wget http://samples.ffmpeg.org/MPEG2/mpegts-klv/Day%20Flight.mpg
    $ ffmpeg -i Day\ Flight.mpg -map data-re -codec copy -f data - | python3 ./klvdata_test.py

        <class 'klvdata.misb0601.UASLocalMetadataSet'>
            <class 'klvdata.misb0601.PrecisionTimeStamp'>
            <class 'klvdata.misb0601.UASLSVersionNumber'>
            <class 'klvdata.misb0601.PlatformHeadingAngle'>
            <class 'klvdata.misb0601.PlatformPitchAngle'>
            <class 'klvdata.misb0601.PlatformRollAngle'>
            <class 'klvdata.misb0601.ImageSourceSensor'>
            <class 'klvdata.misb0601.ImageCoordinateSystem'>
            <class 'klvdata.misb0601.SensorLatitude'>
            <class 'klvdata.misb0601.SensorLongitude'>
            <class 'klvdata.misb0601.SensorTrueAltitude'>
            <class 'klvdata.misb0601.SensorHorizontalFieldOfView'>
            <class 'klvdata.misb0601.SensorVerticalFieldOfView'>
            <class 'klvdata.misb0601.SensorRelativeAzimuthAngle'>
            <class 'klvdata.misb0601.SensorRelativeElevationAngle'>
            <class 'klvdata.misb0601.SensorRelativeRollAngle'>
            <class 'klvdata.misb0601.SlantRange'>
            <class 'klvdata.misb0601.TargetWidth'>
            <class 'klvdata.misb0601.FrameCenterLatitude'>
            <class 'klvdata.misb0601.FrameCenterLongitude'>
            <class 'klvdata.misb0601.FrameCenterElevation'>
            <class 'klvdata.misb0601.TargetLocationLatitude'>
            <class 'klvdata.misb0601.TargetLocationLongitude'>
            <class 'klvdata.misb0601.TargetLocationElevation'>
            <class 'klvdata.misb0601.PlatformGroundSpeed'>
            <class 'klvdata.misb0601.GroundRange'>
            <class 'klvdata.misb0601.Checksum'>

            [...]

Documentation
-------------
Documentation is available at https://paretech.github.io/klvdata.

Contributing
------------
Contributions are welcome! See `Contributing <CONTRIBUTING.md>`_ for details.

Contributors List:
------------------
- `Fran Raga <https://github.com/All4Gis>`_

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/paretech/klvdata/",
    "name": "klv-parser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": "STANAG 4609, MISB, KLV, Metadata, Video",
    "author": "Pazshp",
    "author_email": "pazshp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e5/96/32089472d64cbe4b4886f5ca83b59d61999f8e2ea5855885383563ecdd2c/klv_parser-0.0.4.tar.gz",
    "platform": null,
    "description": "klv_parser\r\n==========\r\n.. image:: https://travis-ci.org/paretech/klvdata.svg?branch=master\r\n    :target: https://travis-ci.org/paretech/klvdata\r\n\r\n.. image:: https://coveralls.io/repos/github/paretech/klvdata/badge.svg?branch=master\r\n    :target: https://coveralls.io/github/paretech/klvdata?branch=master\r\n\r\n.. image:: https://img.shields.io/pypi/v/klvdata.svg\r\n        :target: https://pypi.org/project/klvdata/\r\n\r\nWhat?\r\n-----\r\nKlvdata is a Python library for parsing and constructing Key Length Value (KLV_) formatted binary streams. Common uses of the library would be parsing and displaying `MISB ST`_ 0601 Unmanned Air System (UAS) metadata from `STANAG 4609`_ compliant `MPEG-2 Transport Streams (TS) (MPEG-TS)`_. Note that klvdata alone cannot de-mux KLV data from an MPEG-2 TS, but programs like FFmpeg_ and GStreamer_ can be used with klvdata in the workflow to perform the function.\r\n\r\n.. _KLV: https://en.wikipedia.org/wiki/KLV\r\n.. _STANAG 4609: http://www.gwg.nga.mil/misb/docs/nato_docs/STANAG_4609_Ed3.pdf\r\n.. _MPEG-2 Transport Streams (TS) (MPEG-TS): https://en.wikipedia.org/wiki/MPEG_transport_stream\r\n.. _MISB ST: http://www.gwg.nga.mil/misb/st_pubs.html\r\n.. _FFMpeg: https://www.ffmpeg.org/\r\n.. _GStreamer: https://gstreamer.freedesktop.org/\r\n\r\n\r\nWhy?\r\n----\r\nNot many opensource options available.\r\n\r\nFeatures\r\n--------\r\n- Parses KLV metadata streams.\r\n- Supports `MISB ST`_ 0601 UAS Datalink Local Set.\r\n- Supports `MISB ST`_ 0102 Security Metadata Local Set.\r\n- Built for Python >= 3.5\r\n- Requires no external Python dependencies.\r\n\r\n.. _MISB ST: http://www.gwg.nga.mil/misb/st_pubs.html\r\n\r\nQuick Start\r\n-----------\r\nTry these commands in your GNU/Linux terminal.\r\n\r\nFirst:\r\n\r\n.. code-block:: console\r\n\r\n    $ pip3 install klvdata\r\n    \r\n    $ wget https://raw.githubusercontent.com/paretech/klvdata/master/data/DynamicConstantMISMMSPacketData.bin\r\n\r\n    $ cat << EOF > klvdata_test.py\r\n    #!/usr/bin/env python3\r\n    import sys, klvdata;\r\n    for packet in klvdata.StreamParser(sys.stdin.buffer.read()): packet.structure()\r\n    EOF\r\n\r\n\r\nAnd then:\r\n\r\n.. code-block:: console\r\n\r\n    $ python3 ./klvdata_test.py < DynamicConstantMISMMSPacketData.bin\r\n\r\n        <class 'klvdata.misb0601.UASLocalMetadataSet'>\r\n            <class 'klvdata.misb0601.PrecisionTimeStamp'>\r\n            <class 'klvdata.misb0601.MissionID'>\r\n            <class 'klvdata.misb0601.PlatformHeadingAngle'>\r\n            <class 'klvdata.misb0601.PlatformPitchAngle'>\r\n            <class 'klvdata.misb0601.PlatformRollAngle'>\r\n            <class 'klvdata.misb0601.PlatformDesignation'>\r\n            <class 'klvdata.misb0601.ImageSourceSensor'>\r\n            <class 'klvdata.misb0601.ImageCoordinateSystem'>\r\n            <class 'klvdata.misb0601.SensorLatitude'>\r\n            <class 'klvdata.misb0601.SensorLongitude'>\r\n            <class 'klvdata.misb0601.SensorTrueAltitude'>\r\n            <class 'klvdata.misb0601.SensorHorizontalFieldOfView'>\r\n            <class 'klvdata.misb0601.SensorVerticalFieldOfView'>\r\n            <class 'klvdata.misb0601.SensorRelativeAzimuthAngle'>\r\n            <class 'klvdata.misb0601.SensorRelativeElevationAngle'>\r\n            <class 'klvdata.misb0601.SensorRelativeRollAngle'>\r\n            <class 'klvdata.misb0601.SlantRange'>\r\n            <class 'klvdata.misb0601.TargetWidth'>\r\n            <class 'klvdata.misb0601.FrameCenterLatitude'>\r\n            <class 'klvdata.misb0601.FrameCenterLongitude'>\r\n            <class 'klvdata.misb0601.FrameCenterElevation'>\r\n            <class 'klvdata.misb0102.SecurityLocalMetadataSet'>\r\n                <class 'klvdata.misb0102.SecurityClassification'>\r\n                <class 'klvdata.misb0102.UnknownElement'>\r\n                <class 'klvdata.misb0102.UnknownElement'>\r\n                <class 'klvdata.misb0102.UnknownElement'>\r\n                <class 'klvdata.misb0102.UnknownElement'>\r\n                <class 'klvdata.misb0102.UnknownElement'>\r\n            <class 'klvdata.misb0601.UASLSVersionNumber'>\r\n            <class 'klvdata.misb0601.UnknownElement'>\r\n            <class 'klvdata.misb0601.Checksum'>\r\n\r\nIf you have FFmpeg installed and want to try it on real video from a drone with embedded KLV metadata (~97 MB Download):\r\n\r\n.. code-block:: console\r\n\r\n    $ wget http://samples.ffmpeg.org/MPEG2/mpegts-klv/Day%20Flight.mpg\r\n    $ ffmpeg -i Day\\ Flight.mpg -map data-re -codec copy -f data - | python3 ./klvdata_test.py\r\n\r\n        <class 'klvdata.misb0601.UASLocalMetadataSet'>\r\n            <class 'klvdata.misb0601.PrecisionTimeStamp'>\r\n            <class 'klvdata.misb0601.UASLSVersionNumber'>\r\n            <class 'klvdata.misb0601.PlatformHeadingAngle'>\r\n            <class 'klvdata.misb0601.PlatformPitchAngle'>\r\n            <class 'klvdata.misb0601.PlatformRollAngle'>\r\n            <class 'klvdata.misb0601.ImageSourceSensor'>\r\n            <class 'klvdata.misb0601.ImageCoordinateSystem'>\r\n            <class 'klvdata.misb0601.SensorLatitude'>\r\n            <class 'klvdata.misb0601.SensorLongitude'>\r\n            <class 'klvdata.misb0601.SensorTrueAltitude'>\r\n            <class 'klvdata.misb0601.SensorHorizontalFieldOfView'>\r\n            <class 'klvdata.misb0601.SensorVerticalFieldOfView'>\r\n            <class 'klvdata.misb0601.SensorRelativeAzimuthAngle'>\r\n            <class 'klvdata.misb0601.SensorRelativeElevationAngle'>\r\n            <class 'klvdata.misb0601.SensorRelativeRollAngle'>\r\n            <class 'klvdata.misb0601.SlantRange'>\r\n            <class 'klvdata.misb0601.TargetWidth'>\r\n            <class 'klvdata.misb0601.FrameCenterLatitude'>\r\n            <class 'klvdata.misb0601.FrameCenterLongitude'>\r\n            <class 'klvdata.misb0601.FrameCenterElevation'>\r\n            <class 'klvdata.misb0601.TargetLocationLatitude'>\r\n            <class 'klvdata.misb0601.TargetLocationLongitude'>\r\n            <class 'klvdata.misb0601.TargetLocationElevation'>\r\n            <class 'klvdata.misb0601.PlatformGroundSpeed'>\r\n            <class 'klvdata.misb0601.GroundRange'>\r\n            <class 'klvdata.misb0601.Checksum'>\r\n\r\n            [...]\r\n\r\nDocumentation\r\n-------------\r\nDocumentation is available at https://paretech.github.io/klvdata.\r\n\r\nContributing\r\n------------\r\nContributions are welcome! See `Contributing <CONTRIBUTING.md>`_ for details.\r\n\r\nContributors List:\r\n------------------\r\n- `Fran Raga <https://github.com/All4Gis>`_\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python library for parsing MISB/STANAG 4609 Key Length Value (KLV) metadata.",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/paretech/klvdata/"
    },
    "split_keywords": [
        "stanag 4609",
        " misb",
        " klv",
        " metadata",
        " video"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b07f960e292fc666d190c750ff9622c3b226eba347f467544302ec42d8bb1c61",
                "md5": "e4996d0ef4b21a7584d5d9210802bc03",
                "sha256": "003462cc4db68eb6bdac10b52d7afad6efd6e389acc98db0d3c0f4d3e14a6c46"
            },
            "downloads": -1,
            "filename": "klv_parser-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e4996d0ef4b21a7584d5d9210802bc03",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 29644,
            "upload_time": "2025-01-14T16:41:32",
            "upload_time_iso_8601": "2025-01-14T16:41:32.477136Z",
            "url": "https://files.pythonhosted.org/packages/b0/7f/960e292fc666d190c750ff9622c3b226eba347f467544302ec42d8bb1c61/klv_parser-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e59632089472d64cbe4b4886f5ca83b59d61999f8e2ea5855885383563ecdd2c",
                "md5": "f0dd0596d2a7a1bd497c43a75b66b771",
                "sha256": "b3cf0e00bb6bc6f30cf3195282c487bd67f98f267ce01d4301b6fd27c60affe1"
            },
            "downloads": -1,
            "filename": "klv_parser-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "f0dd0596d2a7a1bd497c43a75b66b771",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 29903,
            "upload_time": "2025-01-14T16:41:34",
            "upload_time_iso_8601": "2025-01-14T16:41:34.810312Z",
            "url": "https://files.pythonhosted.org/packages/e5/96/32089472d64cbe4b4886f5ca83b59d61999f8e2ea5855885383563ecdd2c/klv_parser-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-14 16:41:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paretech",
    "github_project": "klvdata",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "klv-parser"
}
        
Elapsed time: 0.50194s