yta-video-opengl 0.0.4__tar.gz → 0.0.5__tar.gz
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.
- {yta_video_opengl-0.0.4 → yta_video_opengl-0.0.5}/PKG-INFO +1 -1
- {yta_video_opengl-0.0.4 → yta_video_opengl-0.0.5}/pyproject.toml +1 -1
- {yta_video_opengl-0.0.4 → yta_video_opengl-0.0.5}/src/yta_video_opengl/reader.py +9 -38
- {yta_video_opengl-0.0.4 → yta_video_opengl-0.0.5}/src/yta_video_opengl/tests.py +7 -3
- {yta_video_opengl-0.0.4 → yta_video_opengl-0.0.5}/LICENSE +0 -0
- {yta_video_opengl-0.0.4 → yta_video_opengl-0.0.5}/README.md +0 -0
- {yta_video_opengl-0.0.4 → yta_video_opengl-0.0.5}/src/yta_video_opengl/__init__.py +0 -0
- {yta_video_opengl-0.0.4 → yta_video_opengl-0.0.5}/src/yta_video_opengl/writer.py +0 -0
@@ -350,17 +350,8 @@ class VideoReader:
|
|
350
350
|
frame individually as a VideoReaderFrame
|
351
351
|
instance. If not, the whole packet as a
|
352
352
|
VideoReaderPacket instance.
|
353
|
-
|
354
|
-
If the frame is the last one, with size == 0,
|
355
|
-
it will return None as it must not be passed
|
356
|
-
to the muxer '.mux()' method.
|
357
353
|
"""
|
358
354
|
for packet in self.packet_with_audio_iterator:
|
359
|
-
if packet.size == 0:
|
360
|
-
# End packet, not for muxer
|
361
|
-
yield None
|
362
|
-
continue
|
363
|
-
|
364
355
|
is_video = packet.stream.type == 'video'
|
365
356
|
|
366
357
|
do_decode = (
|
@@ -386,34 +377,14 @@ class VideoReader:
|
|
386
377
|
|
387
378
|
|
388
379
|
"""
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
Puedes lanzar un proceso FFmpeg que envíe el vídeo a PyAV por stdin como flujo sin codificar (por ejemplo en rawvideo), así no tienes que escribir el archivo final.
|
396
|
-
Ejemplo:
|
397
|
-
|
398
|
-
PYTHON_CODE:
|
399
|
-
import subprocess
|
400
|
-
import av
|
401
|
-
|
402
|
-
# FFmpeg produce frames en crudo por stdout
|
403
|
-
ffmpeg_proc = subprocess.Popen(
|
404
|
-
[
|
405
|
-
"ffmpeg",
|
406
|
-
"-i", "-", # Lee de stdin
|
407
|
-
"-f", "rawvideo",
|
408
|
-
"-pix_fmt", "rgba",
|
409
|
-
"-"
|
410
|
-
],
|
411
|
-
stdin=subprocess.PIPE,
|
412
|
-
stdout=subprocess.PIPE
|
413
|
-
)
|
414
|
-
|
415
|
-
# Aquí enviarías los datos combinados desde tu programa al ffmpeg_proc.stdin
|
416
|
-
# y podrías leer con PyAV o directamente procesar arrays de píxeles
|
380
|
+
When reading packets directly from the stream
|
381
|
+
we can receive packets with size=0, but we need
|
382
|
+
to process them and decode (or yield them). It
|
383
|
+
is only when we are passing packets to the mux
|
384
|
+
when we need to ignore teh ones thar are empty
|
385
|
+
(size=0).
|
417
386
|
|
418
|
-
|
387
|
+
TODO: Do we need to ignore all? By now, ignoring
|
388
|
+
not is causing exceptions, and ignoring them is
|
389
|
+
making it work perfectly.
|
419
390
|
"""
|
@@ -65,9 +65,6 @@ def video_modified_stored():
|
|
65
65
|
|
66
66
|
video = VideoReader(VIDEO_PATH)
|
67
67
|
|
68
|
-
print(video.number_of_frames)
|
69
|
-
print(video.number_of_audio_frames)
|
70
|
-
|
71
68
|
# TODO: This has to be dynamic, but
|
72
69
|
# according to what (?)
|
73
70
|
NUMPY_FORMAT = 'rgb24'
|
@@ -82,6 +79,13 @@ def video_modified_stored():
|
|
82
79
|
|
83
80
|
# Decode first frame and use as texture
|
84
81
|
first_frame = video.next_frame
|
82
|
+
# We need to reset it to being again pointing
|
83
|
+
# to the first frame...
|
84
|
+
# TODO: Improve this by, maybe, storing the first
|
85
|
+
# frame in memory so we can append it later, or
|
86
|
+
# using the '.seek(0)' even when it could be not
|
87
|
+
# accurate
|
88
|
+
video = VideoReader(VIDEO_PATH)
|
85
89
|
|
86
90
|
# Most of OpenGL textures expect origin in lower
|
87
91
|
# left corner
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|