caffeinism-utils 0.0.181__py3-none-any.whl → 0.0.183__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -232,7 +232,13 @@ def to_yuva420p(reader: Iterable[av.VideoFrame]):
232
232
 
233
233
  graph = Graph()
234
234
  buffer = graph.add_buffer(template=first_frame)
235
- buffer >> graph.add("format", pix_fmts="yuva420p", color_ranges="tv", color_spaces="bt709") >> graph.add("buffersink")
235
+ (
236
+ buffer
237
+ >> graph.add(
238
+ "format", pix_fmts="yuva420p", color_ranges="tv", color_spaces="bt709"
239
+ )
240
+ >> graph.add("buffersink")
241
+ )
236
242
  graph.configure()
237
243
 
238
244
  graph.push(first_frame)
@@ -244,6 +250,7 @@ def to_yuva420p(reader: Iterable[av.VideoFrame]):
244
250
 
245
251
  graph.push(None)
246
252
 
253
+
247
254
  def to_array(iterator: list[av.VideoFrame]):
248
255
  for frame in iterator:
249
256
  yield frame.to_ndarray()
caffeinism_utils/av/io.py CHANGED
@@ -20,6 +20,62 @@ from .filters import AlphaExtractor, AlphaMerger, BaseAlphaMerger, NotAlphaMerge
20
20
 
21
21
  TIME_BASE = fractions.Fraction(1, 90000)
22
22
 
23
+ ffmpeg_color_info = {
24
+ "color_range": {0: "unknown", 1: "tv", 2: "pc"},
25
+ "colorspace": {
26
+ 0: "rgb",
27
+ 1: "bt709",
28
+ 2: "unknown",
29
+ 4: "fcc",
30
+ 5: "bt470bg",
31
+ 6: "smpte170m",
32
+ 7: "smpte240m",
33
+ 8: "ycgco",
34
+ 9: "bt2020nc",
35
+ 10: "bt2020c",
36
+ 11: "smpte2085",
37
+ 12: "chroma-derived-nc",
38
+ 13: "chroma-derived-c",
39
+ 14: "ictcp",
40
+ 15: "ipt-c2",
41
+ 16: "ycgco-re",
42
+ 17: "ycgco-ro",
43
+ },
44
+ "color_primaries": {
45
+ 1: "bt709",
46
+ 2: "unknown",
47
+ 4: "bt470m",
48
+ 5: "bt470bg",
49
+ 6: "smpte170m",
50
+ 7: "smpte240m",
51
+ 8: "film",
52
+ 9: "bt2020",
53
+ 10: "smpte428",
54
+ 11: "smpte431",
55
+ 12: "smpte432",
56
+ 22: "jedec-p22",
57
+ },
58
+ "color_trc": {
59
+ 1: "bt709",
60
+ 2: "unknown",
61
+ 4: "gamma22",
62
+ 5: "gamma28",
63
+ 6: "smpte170m",
64
+ 7: "smpte240m",
65
+ 8: "linear",
66
+ 9: "log100",
67
+ 10: "log316",
68
+ 11: "iec61966-2-4",
69
+ 12: "bt1361e",
70
+ 13: "iec61966-2-1",
71
+ 14: "bt2020-10",
72
+ 15: "bt2020-12",
73
+ 16: "smpte2084",
74
+ 17: "smpte428",
75
+ 18: "arib-std-b67",
76
+ },
77
+ }
78
+
23
79
 
24
80
  class PyAVInterface(ABC):
25
81
  _container: av.container.Container
@@ -47,6 +103,22 @@ class PyAVInterface(ABC):
47
103
  self._init_container()
48
104
  return self._streams
49
105
 
106
+ @property
107
+ def colorspace(self) -> str:
108
+ return ffmpeg_color_info["colorspace"][self.streams[0].colorspace]
109
+
110
+ @property
111
+ def color_trc(self) -> str:
112
+ return ffmpeg_color_info["color_trc"][self.streams[0].color_trc]
113
+
114
+ @property
115
+ def color_primaries(self) -> str:
116
+ return ffmpeg_color_info["color_primaries"][self.streams[0].color_primaries]
117
+
118
+ @property
119
+ def color_range(self) -> str:
120
+ return ffmpeg_color_info["color_range"][self.streams[0].color_range]
121
+
50
122
  @property
51
123
  def fps(self):
52
124
  return self.streams[0].base_rate or self.streams[0].codec_context.framerate
@@ -416,7 +488,7 @@ class PyAVWriter(PyAVInterface):
416
488
  cc.qmax = stream_cc.qmax
417
489
  cc.qmin = stream_cc.qmin
418
490
 
419
- cc.options = stream_cc.options
491
+ cc.options = self._options
420
492
 
421
493
  return cc
422
494
 
@@ -1,6 +1,7 @@
1
1
  import av
2
2
  import numba
3
3
 
4
+
4
5
  @numba.jit(
5
6
  (
6
7
  numba.types.MemoryView(numba.uint8, 1, "C"),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: caffeinism-utils
3
- Version: 0.0.181
3
+ Version: 0.0.183
4
4
  Summary:
5
5
  Author: Kim Minjong
6
6
  Author-email: make.dirty.code@gmail.com
@@ -3,15 +3,15 @@ caffeinism_utils/aiteration.py,sha256=0WDoAcx_2veSfVTgtT-v-aPrbNwgyd6WkWb3lJGcZV
3
3
  caffeinism_utils/asyncio.py,sha256=33yJ51vY0JvS6HJiBsEXXxAE3UlpLeudK8tanlu599Y,4811
4
4
  caffeinism_utils/av/__init__.py,sha256=J7dtpfW9R9BH-HJmlubAaFMqcEOMOu--zH64XJ7A2hI,423
5
5
  caffeinism_utils/av/codecs.py,sha256=gkOeazEqJWC1fRTLGpjdQbeorpVZpRHDzN7Ky01AML8,3360
6
- caffeinism_utils/av/filters.py,sha256=bG5MH_G2XaDx0iT938agrQ3MZPC6IjlROSFdUk9Dtjs,16174
7
- caffeinism_utils/av/io.py,sha256=OsfwT5f6obS6LGI0Hk48vzLSdOtm3C5vDRxPnqeI7W8,16878
8
- caffeinism_utils/av/utils.py,sha256=G3jUBtErX8gBlnB1PBloCtDjHdC4-gO7sAbei5AtJEw,6195
6
+ caffeinism_utils/av/filters.py,sha256=-jb7S96bQuhGAnEaohzfVZbTqXDnl_fHW1XOUfpzTb4,16229
7
+ caffeinism_utils/av/io.py,sha256=WS5NcFWVdUQo8mGh0w0v8dnRkSV0XJMBfZZUeU9WVVQ,18613
8
+ caffeinism_utils/av/utils.py,sha256=bBbmwDO0PCX9rJvfho9GO7hjBZqXudEjAvrgc9dWD94,6196
9
9
  caffeinism_utils/http.py,sha256=ZDcdHxaSPzbo6Jy2RfWl6Ib5Hii2170AkXlb-KKuI4I,424
10
10
  caffeinism_utils/io.py,sha256=cgA7LwV8zgfEd3Qaubogow3V21IR4yp2drRmOgql6Tw,3771
11
11
  caffeinism_utils/iteration.py,sha256=7BddGudGRBmNyJi3cTpmcQ2zWplu5zjxYCN4J_cWe3c,3026
12
12
  caffeinism_utils/prefetch.py,sha256=yNTbBaSF-BA5iA1zUfnWVvcMm3br5nlBmPgvBMXHO7I,4144
13
13
  caffeinism_utils/utils.py,sha256=-g0DDuiCrck4xjN9T5ZUaklClXqDLCfOB6PKN4D8mlE,927
14
14
  caffeinism_utils/zip.py,sha256=L1d8qfphao-iD5G7bDu4LMQNg6ULc4kCqUk5gJbhSdE,1679
15
- caffeinism_utils-0.0.181.dist-info/METADATA,sha256=kS4Wetd8MkEUeoMmelbPBi4Nl3OpOr8EkEM_uBxLxZY,955
16
- caffeinism_utils-0.0.181.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
17
- caffeinism_utils-0.0.181.dist-info/RECORD,,
15
+ caffeinism_utils-0.0.183.dist-info/METADATA,sha256=T3KzhjPay0auUGkRUoSsSDG3jaMIFn2BR4T7eoKVvkU,955
16
+ caffeinism_utils-0.0.183.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
17
+ caffeinism_utils-0.0.183.dist-info/RECORD,,