Skip to main content
# NutMeg

A collection of simple video processing tools. Nice Python classes and functions
that wrap practical predefined ffmpeg commands.


## Example NutmegClip

```python
f = '/home/Videos/GoPro/Malibu/GOPR6248.MP4'

p = NutmegProbe()
p.probe(f)

print('\nOriginal file: {}'.format(os.path.basename(f)))
print('Original duration: {}'.format(p.results.container.duration))

time_start = 0
time_stop = 0.5*p.results.container.duration

c = NutmegClip()
c.clip(f, time_start, time_stop)

print('\nClip file: {}'.format(os.path.basename(c.results.fname_out)))

p = NutmegProbe()
p.probe(c.results.fname_out)

print('Clip duration: {}'.format(p.results.container.duration))

```

The above example yields the following output:

```text
Original file: GOPR6248.MP4
Original duration: 40.323617

Clip file: GOPR6248.clip-0.00-20.16.mp4
Clip duration: 20.182

```


## Example NutmegProbe

```python
f = '/home/Videos/GoPro/Malibu/GOPR6248.MP4'

p = NutmegProbe()
p.probe(f)

print('\nContainer:')
IPython.display.display(p.results.container)

for s in p.results.streams:
print('\nStream {}:'.format(s.index))
IPython.display.display(s)
```

Running the above sample code yields the following output:

Container:
```python
{'bit_rate': '24243114',
'duration': '40.323617',
'filename': '/home/Videos/GoPro/Malibu/GOPR6248.MP4',
'format_long_name': 'QuickTime / MOV',
'format_name': 'mov,mp4,m4a,3gp,3g2,mj2',
'nb_programs': 0,
'nb_streams': 3,
'probe_score': 100,
'size': '122196256',
'start_time': '0.000000',
'tags': {'compatible_brands': 'avc1isom',
'creation_time': '2014-07-06T15:20:02.000000Z',
'major_brand': 'avc1',
'minor_version': '0'}}
```

Stream 0:
```python
{'avg_frame_rate': '60000/1001',
'bit_rate': '23967131',
'bits_per_raw_sample': '8',
'chroma_location': 'left',
'codec_long_name': 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10',
'codec_name': 'h264',
'codec_tag': '0x31637661',
'codec_tag_string': 'avc1',
'codec_time_base': '1001/120000',
'codec_type': 'video',
'coded_height': 1080,
'coded_width': 1920,
'color_primaries': 'bt709',
'color_range': 'pc',
'color_space': 'bt709',
'color_transfer': 'bt709',
'display_aspect_ratio': '16:9',
'disposition': {'attached_pic': 0,
'clean_effects': 0,
'comment': 0,
'default': 1,
'dub': 0,
'forced': 0,
'hearing_impaired': 0,
'karaoke': 0,
'lyrics': 0,
'original': 0,
'visual_impaired': 0},
'duration': '40.323617',
'duration_ts': 2419417,
'has_b_frames': 1,
'height': 1080,
'index': 0,
'is_avc': 'true',
'level': 42,
'nal_length_size': '4',
'nb_frames': '2417',
'pix_fmt': 'yuvj420p',
'profile': 'Main',
'r_frame_rate': '60000/1001',
'refs': 1,
'sample_aspect_ratio': '1:1',
'start_pts': 0,
'start_time': '0.000000',
'tags': {'creation_time': '2014-07-06T15:20:02.000000Z',
'encoder': 'GoPro AVC encoder',
'handler_name': '\rGoPro AVC',
'language': 'eng',
'timecode': '15:19:06:51'},
'time_base': '1/60000',
'width': 1920}
```

Stream 1:
```python
{'avg_frame_rate': '0/0',
'bit_rate': '128040',
'bits_per_sample': 0,
'channel_layout': 'stereo',
'channels': 2,
'codec_long_name': 'AAC (Advanced Audio Coding)',
'codec_name': 'aac',
'codec_tag': '0x6134706d',
'codec_tag_string': 'mp4a',
'codec_time_base': '1/48000',
'codec_type': 'audio',
'disposition': {'attached_pic': 0,
'clean_effects': 0,
'comment': 0,
'default': 1,
'dub': 0,
'forced': 0,
'hearing_impaired': 0,
'karaoke': 0,
'lyrics': 0,
'original': 0,
'visual_impaired': 0},
'duration': '40.320000',
'duration_ts': 1935360,
'index': 1,
'nb_frames': '1890',
'profile': 'LC',
'r_frame_rate': '0/0',
'sample_fmt': 'fltp',
'sample_rate': '48000',
'start_pts': 0,
'start_time': '0.000000',
'tags': {'creation_time': '2014-07-06T15:20:02.000000Z',
'handler_name': '\rGoPro AAC',
'language': 'eng',
'timecode': '15:19:06:51'},
'time_base': '1/48000'}
```

Stream 2:
```python
{'avg_frame_rate': '60/1',
'codec_tag': '0x64636d74',
'codec_tag_string': 'tmcd',
'codec_type': 'data',
'disposition': {'attached_pic': 0,
'clean_effects': 0,
'comment': 0,
'default': 1,
'dub': 0,
'forced': 0,
'hearing_impaired': 0,
'karaoke': 0,
'lyrics': 0,
'original': 0,
'visual_impaired': 0},
'duration': '40.323617',
'duration_ts': 2419417,
'index': 2,
'nb_frames': '1',
'r_frame_rate': '0/0',
'start_pts': 0,
'start_time': '0.000000',
'tags': {'creation_time': '2014-07-06T15:20:02.000000Z',
'language': 'eng',
'timecode': '15:19:06:51'},
'time_base': '1/60000'}
```


Metadata

Release files for nutmeg 2018.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nutmeg 2018.1.12
File Size Uploaded Provenance
nutmeg-2018.1.12.tar.gz 6.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nutmeg 2018.1.12
File Interpreter ABI Platform
nutmeg-2018.1.12-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 15.9 kB

Release files / nutmeg-2018.1.12.tar.gz

Download URL nutmeg-2018.1.12.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
760d52b5000fe6e77139026637c05fbbce296120d3cedc684bdbab3815acb675
BLAKE2b-256 checksum
How to use checksums
bd0c81b68e6b1f5ea27b31a54bd132a17fd01a49c0d5cefdc0f02c5d48e4e914
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nutmeg-2018.1.12-py2.py3-none-any.whl

Download URL nutmeg-2018.1.12-py2.py3-none-any.whl
Size 9.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7f942e7251f2d66ef5d8ec8e9811188b71262026d3bab12a11415c95ac7646dc
BLAKE2b-256 checksum
How to use checksums
add6a73bf242b5eb2c400a3af36c56e371231ca4cb4a56959bf91820032e939a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nutmeg 2018.1.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page