#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function import io import logging import click import os from pymp4.parser import Box import construct log = logging.getLogger(__name__) construct.setglobalfullprinting(True) # data offset, has_length, termination emb_file_def = { b'sttm': (4, False, None, None), b'ptnm': (4, False, None, None), b'ptrh': (4, False, None, None), b'thum': (8, True, None, '.jpg'), b'gps ': (4, False, b'\x00', '.nmea'), b'3gf ': (4, False, b'\xff' * 10, '.3gf'), } @click.command(context_settings=dict(help_option_names=['-h', '--help'])) @click.option('-c', '--dump-embedded', is_flag=True, help='Dump complete embedded data.') @click.option('-r',
#!/usr/bin/env python from __future__ import print_function import io import logging import argparse from pymp4.parser import Box from construct import setglobalfullprinting log = logging.getLogger(__name__) setglobalfullprinting(True) def dump(): parser = argparse.ArgumentParser(description='Dump all the boxes from an MP4 file') parser.add_argument("input_file", type=argparse.FileType("rb"), metavar="FILE", help="Path to the MP4 file to open") args = parser.parse_args() fd = args.input_file fd.seek(0, io.SEEK_END) eof = fd.tell() fd.seek(0) while fd.tell() < eof: box = Box.parse_stream(fd) print(box)