Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
my-flink-project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
AI算法平台
my-flink-project
Commits
a7baada6
Commit
a7baada6
authored
Nov 02, 2023
by
周昊
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into production
# Conflicts: # src/main/java/com/censoft/flink/StreamingJob.java
parents
dd67bbaf
6fb2909a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
153 deletions
+0
-153
pom.xml
pom.xml
+0
-19
src/main/java/com/censoft/flink/StreamingJob.java
src/main/java/com/censoft/flink/StreamingJob.java
+0
-12
src/main/java/com/censoft/flink/domain/AlgorithmWarnPushDto.java
...n/java/com/censoft/flink/domain/AlgorithmWarnPushDto.java
+0
-3
src/main/java/com/censoft/flink/utils/RtspToMP4.java
src/main/java/com/censoft/flink/utils/RtspToMP4.java
+0
-94
src/main/resources/config/iccSdk.properties
src/main/resources/config/iccSdk.properties
+0
-25
No files found.
pom.xml
View file @
a7baada6
...
...
@@ -153,25 +153,6 @@ under the License.
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.28
</version>
</dependency>
<!-- ICC鉴权 -->
<dependency>
<groupId>
com.dahuatech.icc
</groupId>
<artifactId>
java-sdk-oauth
</artifactId>
<version>
1.0.9.1
</version>
<exclusions>
<exclusion>
<artifactId>
java-sdk-core
</artifactId>
<groupId>
com.dahuatech.icc
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.dahuatech.icc
</groupId>
<artifactId>
java-sdk-core
</artifactId>
<version>
1.0.9.1
</version>
</dependency>
</dependencies>
<build>
...
...
src/main/java/com/censoft/flink/StreamingJob.java
View file @
a7baada6
...
...
@@ -8,14 +8,6 @@ import com.censoft.flink.transform.AlgorithmBaseFilterFunction;
import
com.censoft.flink.transform.AlgorithmTypeFlatMapFunction
;
import
com.censoft.flink.transform.ResultExistFilterFunction
;
import
com.censoft.flink.transform.UpdateLiveFilterFunction
;
import
com.censoft.flink.utils.RtspToMP4
;
import
com.dahuatech.hutool.json.JSONObject
;
import
com.dahuatech.hutool.json.JSONUtil
;
import
com.dahuatech.icc.exception.ClientException
;
import
com.dahuatech.icc.oauth.http.DefaultClient
;
import
com.dahuatech.icc.oauth.http.IClient
;
import
com.dahuatech.icc.oauth.model.v202010.GeneralRequest
;
import
com.dahuatech.icc.oauth.model.v202010.GeneralResponse
;
import
org.apache.flink.api.common.serialization.SimpleStringSchema
;
import
org.apache.flink.api.java.utils.ParameterTool
;
import
org.apache.flink.core.fs.FileSystem
;
...
...
@@ -24,9 +16,7 @@ import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
;
import
org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer
;
import
java.io.InputStream
;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -101,8 +91,6 @@ public class StreamingJob {
warnPushBase
.
setAlarmTime
(
new
Date
(
algorithmPushDto
.
getTimeStamp
()
*
1000
));
//获取图片地址
warnPushBase
.
setPicture
(
"http://172.16.21.3"
+
algorithmPushDto
.
getPictureAddress
());
//获取视频地址
warnPushBase
.
setVideo
(
getVideo
(
"1000790$1$0$0"
,
1698868554L
,
1698868654L
));
warnPushBase
.
setStatus
(
"wait"
);
warnPushBase
.
setSendUserIds
(
"|1|"
);
warnPushBase
.
setDelFlag
(
0
);
...
...
src/main/java/com/censoft/flink/domain/AlgorithmWarnPushDto.java
View file @
a7baada6
...
...
@@ -28,9 +28,6 @@ public class AlgorithmWarnPushDto {
/** 图片地址 */
private
String
picture
;
/** 视频地址 */
private
String
video
;
/** 处置状态 */
private
String
status
;
...
...
src/main/java/com/censoft/flink/utils/RtspToMP4.java
deleted
100644 → 0
View file @
dd67bbaf
package
com
.
censoft
.
flink
.
utils
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* TODO:
*
* @Author: ZHANG
* @create: 2021/8/27 16:11
*/
public
class
RtspToMP4
{
public
static
class
In
implements
Runnable
{
private
InputStream
inputStream
;
public
In
(
InputStream
inputStream
)
{
this
.
inputStream
=
inputStream
;
}
@Override
public
void
run
()
{
try
{
//转成字符输入流
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
inputStream
,
"gbk"
);
int
len
=
-
1
;
char
[]
c
=
new
char
[
1024
];
//读取进程输入流中的内容
while
((
len
=
inputStreamReader
.
read
(
c
))
!=
-
1
)
{
String
s
=
new
String
(
c
,
0
,
len
);
System
.
out
.
print
(
s
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
public
static
void
main
(
String
[]
args
)
{
StartRecord
(
"E:\\ffmpeg\\bin\\ffmpeg.exe"
,
"rtsp://192.168.18.203:554/av0_0"
,
"D:\\data\\MP4\\3.mp4"
);
}
public
static
Process
StartRecord
(
String
ffmpegPath
,
String
streamUrl
,
String
FilePath
){
ProcessBuilder
processBuilder
=
new
ProcessBuilder
();
//定义命令内容
List
<
String
>
command
=
new
ArrayList
<>();
command
.
add
(
ffmpegPath
);
command
.
add
(
"-rtsp_transport"
);
command
.
add
(
"tcp"
);
command
.
add
(
"-y"
);
command
.
add
(
"-i"
);
command
.
add
(
streamUrl
);
command
.
add
(
"-c"
);
command
.
add
(
"copy"
);
command
.
add
(
"-f"
);
command
.
add
(
"mp4"
);
command
.
add
(
FilePath
);
processBuilder
.
command
(
command
);
System
.
out
.
println
(
"脚本:"
+
command
.
toString
());
//将标准输入流和错误输入流合并,通过标准输入流读取信息
processBuilder
.
redirectErrorStream
(
true
);
try
{
//启动进程
Process
process
=
processBuilder
.
start
();
System
.
out
.
println
(
"开始时间:"
+
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
(
System
.
currentTimeMillis
())));
//获取输入流
InputStream
inputStream
=
process
.
getInputStream
();
Thread
inThread
=
new
Thread
(
new
In
(
inputStream
));
inThread
.
start
();
return
process
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
public
boolean
stopRecord
(
Process
process
)
{
try
{
OutputStream
os
=
process
.
getOutputStream
();
os
.
write
(
"q"
.
getBytes
());
// 一定要刷新
os
.
flush
();
os
.
close
();
}
catch
(
Exception
err
)
{
err
.
printStackTrace
();
return
false
;
}
return
true
;
}
}
src/main/resources/config/iccSdk.properties
deleted
100644 → 0
View file @
dd67bbaf
#服务地址 端口默认是443
#icc.sdk.host=115.236.17.59:9021
icc.sdk.host
=
172.16.51.2
#是否启用https访问,默认:是
#icc.sdk.enable.https=false
#认证类型=[client_credentials],[password],client_credentials:客户端鉴权模式;password:用户密码鉴权模式
icc.sdk.grantType
=
password
#-----------客户端鉴权模式--------------
#客户端鉴权模式申请访问凭证id
icc.sdk.clientId
=
CompanyName
#客户端鉴权模式申请访问凭证密钥
icc.sdk.clientSecret
=
67987667-8651-44f1-a3da-f6796e5f23e6
#客户端鉴权模式默认用户,默认是1,超级管理员
#icc.sdk.config.client.userId=1
#-----------用户密码鉴权模式--------------
#用户密码鉴权模式申请访问凭证id
icc.sdk.pwdClientId
=
CompanyName
#用户密码鉴权模式申请访问凭证密钥
icc.sdk.pwdClientSecret
=
67987667-8651-44f1-a3da-f6796e5f23e6
#用户名
icc.sdk.username
=
system
#密码
icc.sdk.password
=
Admin@123
#http调试模式 false:开启,true:关闭
icc.sdk.enable.https
=
true
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