Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
3104d2f7
Commit
3104d2f7
authored
May 14, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11482 from allnes:gst_remove_container
parents
e0dbe5cf
9bd57391
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
gstreamer_pipeline.cpp
samples/cpp/gstreamer_pipeline.cpp
+19
-9
No files found.
samples/cpp/gstreamer_pipeline.cpp
View file @
3104d2f7
...
@@ -18,7 +18,6 @@ class GStreamerPipeline
...
@@ -18,7 +18,6 @@ class GStreamerPipeline
"{h help usage ? | | print help messages }"
"{h help usage ? | | print help messages }"
"{m mode | | coding mode (supported: encode, decode) }"
"{m mode | | coding mode (supported: encode, decode) }"
"{p pipeline |default | pipeline name (supported: 'default', 'gst-basic', 'gst-vaapi', 'gst-libav', 'ffmpeg') }"
"{p pipeline |default | pipeline name (supported: 'default', 'gst-basic', 'gst-vaapi', 'gst-libav', 'ffmpeg') }"
"{ct container |mp4 | container name (supported: 'mp4', 'mov', 'avi', 'mkv') }"
"{cd codec |h264 | codec name (supported: 'h264', 'h265', 'mpeg2', 'mpeg4', 'mjpeg', 'vp8') }"
"{cd codec |h264 | codec name (supported: 'h264', 'h265', 'mpeg2', 'mpeg4', 'mjpeg', 'vp8') }"
"{f file path | | path to file }"
"{f file path | | path to file }"
"{vr resolution |720p | video resolution for encoding (supported: '720p', '1080p', '4k') }"
"{vr resolution |720p | video resolution for encoding (supported: '720p', '1080p', '4k') }"
...
@@ -30,24 +29,29 @@ class GStreamerPipeline
...
@@ -30,24 +29,29 @@ class GStreamerPipeline
if
(
cmd_parser
->
has
(
"help"
))
if
(
cmd_parser
->
has
(
"help"
))
{
{
cmd_parser
->
printMessage
();
cmd_parser
->
printMessage
();
exit_code
=
-
1
;
CV_Error
(
Error
::
StsBadArg
,
"Called help."
)
;
}
}
fast_measure
=
cmd_parser
->
has
(
"fast"
);
// fast measure fps
fast_measure
=
cmd_parser
->
has
(
"fast"
);
// fast measure fps
fix_fps
=
cmd_parser
->
get
<
int
>
(
"fps"
);
// fixed frame per second
fix_fps
=
cmd_parser
->
get
<
int
>
(
"fps"
);
// fixed frame per second
pipeline
=
cmd_parser
->
get
<
string
>
(
"pipeline"
),
// gstreamer pipeline type
pipeline
=
cmd_parser
->
get
<
string
>
(
"pipeline"
),
// gstreamer pipeline type
container
=
cmd_parser
->
get
<
string
>
(
"container"
),
// container type
mode
=
cmd_parser
->
get
<
string
>
(
"mode"
),
// coding mode
mode
=
cmd_parser
->
get
<
string
>
(
"mode"
),
// coding mode
codec
=
cmd_parser
->
get
<
string
>
(
"codec"
),
// codec type
codec
=
cmd_parser
->
get
<
string
>
(
"codec"
),
// codec type
file_name
=
cmd_parser
->
get
<
string
>
(
"file"
),
// path to videofile
file_name
=
cmd_parser
->
get
<
string
>
(
"file"
),
// path to videofile
resolution
=
cmd_parser
->
get
<
string
>
(
"resolution"
);
// video resolution
resolution
=
cmd_parser
->
get
<
string
>
(
"resolution"
);
// video resolution
size_t
found
=
file_name
.
rfind
(
"."
);
if
(
found
!=
string
::
npos
)
{
container
=
file_name
.
substr
(
found
+
1
);
// container type
}
else
{
CV_Error
(
Error
::
StsBadArg
,
"Can not parse container extension."
);
}
if
(
!
cmd_parser
->
check
())
if
(
!
cmd_parser
->
check
())
{
{
cmd_parser
->
printErrors
();
cmd_parser
->
printErrors
();
exit_code
=
-
1
;
CV_Error
(
Error
::
StsBadArg
,
"Failed parse arguments."
)
;
}
}
exit_code
=
0
;
}
}
~
GStreamerPipeline
()
{
delete
cmd_parser
;
}
~
GStreamerPipeline
()
{
delete
cmd_parser
;
}
...
@@ -55,7 +59,6 @@ class GStreamerPipeline
...
@@ -55,7 +59,6 @@ class GStreamerPipeline
// Start pipeline
// Start pipeline
int
run
()
int
run
()
{
{
if
(
exit_code
<
0
)
{
return
exit_code
;
}
if
(
mode
==
"decode"
)
{
if
(
createDecodePipeline
()
<
0
)
return
-
1
;
}
if
(
mode
==
"decode"
)
{
if
(
createDecodePipeline
()
<
0
)
return
-
1
;
}
else
if
(
mode
==
"encode"
)
{
if
(
createEncodePipeline
()
<
0
)
return
-
1
;
}
else
if
(
mode
==
"encode"
)
{
if
(
createEncodePipeline
()
<
0
)
return
-
1
;
}
else
else
...
@@ -423,7 +426,6 @@ class GStreamerPipeline
...
@@ -423,7 +426,6 @@ class GStreamerPipeline
resolution
;
// video resolution
resolution
;
// video resolution
int
fix_fps
;
// fixed frame per second
int
fix_fps
;
// fixed frame per second
Size
fix_size
;
// fixed frame size
Size
fix_size
;
// fixed frame size
int
exit_code
;
VideoWriter
wrt
;
VideoWriter
wrt
;
VideoCapture
cap
;
VideoCapture
cap
;
ostringstream
stream_pipeline
;
ostringstream
stream_pipeline
;
...
@@ -432,6 +434,14 @@ class GStreamerPipeline
...
@@ -432,6 +434,14 @@ class GStreamerPipeline
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
GStreamerPipeline
pipe
(
argc
,
argv
);
try
return
pipe
.
run
();
{
GStreamerPipeline
pipe
(
argc
,
argv
);
return
pipe
.
run
();
}
catch
(
const
Exception
&
e
)
{
cerr
<<
e
.
what
()
<<
endl
;
return
1
;
}
}
}
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