Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2016104096
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
강수빈
2020-12-14 06:19:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
efccfbb3af027637abc0364668669a34f937125e
efccfbb3
1 parent
93177da7
hz 계산 웹서버 코드 수정
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
code/note.py
code/test.wav
code/note.py
View file @
efccfbb
...
...
@@ -13,13 +13,21 @@ def maiddn():
def
upload_file
():
params
=
json
.
loads
(
request
.
get_data
(),
encoding
=
'utf-8'
)
data
=
params
[
'datas'
]
timeData
=
params
[
'timeData'
]
print
(
len
(
data
))
make_wav_file
(
data
)
print
(
timeData
)
make_wav_file
(
data
,
timeData
)
return
send_file
(
"test.wav"
,
attachment_filename
=
'test.wav'
,
as_attachment
=
True
)
def
make_wav_file
(
data
):
def
make_wav_file
(
data
,
timeData
):
print
(
'convert is loading'
)
print
(
len
(
data
))
print
(
timeData
)
print
(
len
(
data
)
/
timeData
)
hz
=
int
(
len
(
data
)
/
timeData
)
print
(
"hz="
)
print
(
hz
)
eng
=
matlab
.
engine
.
start_matlab
()
l1
=
[]
for
t
in
data
:
...
...
@@ -29,8 +37,9 @@ def make_wav_file(data):
print
(
t
)
l2
=
[
n
/
10000
for
n
in
l1
]
data
=
matlab
.
double
(
l2
)
filename
=
'test.wav'
eng
.
audiowrite
(
filename
,
data
,
1000
,
nargout
=
0
)
eng
.
audiowrite
(
filename
,
data
,
hz
,
nargout
=
0
)
eng
.
quit
()
@app.route
(
'/combine'
,
methods
=
[
'POST'
])
...
...
@@ -40,7 +49,6 @@ def combineMp4Wav():
print
(
"error"
)
return
"error"
file
=
request
.
files
[
'Video'
]
print
(
file
)
file
.
save
(
"video.mp4"
)
os
.
system
(
"ffmpeg -i video.mp4 -i test.wav -c:v copy -c:a aac -strict experimental -vcodec libx264 -map 0:v:0 -map 1:a:0 -y output.mp4"
)
return
"Success"
...
...
code/test.wav
View file @
efccfbb
No preview for this file type
Please
register
or
login
to post a comment