Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
SexhackmeStreamer
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
SexhackmeStreamer
Commits
85be6bd0
Commit
85be6bd0
authored
Sep 30, 2024
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pipe example
parent
4e2d7a83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
pipe.py
pipe.py
+26
-0
No files found.
pipe.py
0 → 100644
View file @
85be6bd0
import
cv2
import
subprocess
as
sp
import
numpy
FFMPEG_BIN
=
"ffmpeg"
command
=
[
FFMPEG_BIN
,
'-i'
,
'fifo'
,
# fifo is the named pipe
'-pix_fmt'
,
'bgr24'
,
# opencv requires bgr24 pixel format.
'-vcodec'
,
'rawvideo'
,
'-an'
,
'-sn'
,
# we want to disable audio processing (there is no audio)
'-f'
,
'image2pipe'
,
'-'
]
pipe
=
sp
.
Popen
(
command
,
stdout
=
sp
.
PIPE
,
bufsize
=
10
**
8
)
while
True
:
# Capture frame-by-frame
raw_image
=
pipe
.
stdout
.
read
(
640
*
480
*
3
)
# transform the byte read into a numpy array
image
=
numpy
.
fromstring
(
raw_image
,
dtype
=
'uint8'
)
image
=
image
.
reshape
((
480
,
640
,
3
))
# Notice how height is specified first and then width
if
image
is
not
None
:
cv2
.
imshow
(
'Video'
,
image
)
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'q'
):
break
pipe
.
stdout
.
flush
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment