Showing
9 changed files
with
19 additions
and
4 deletions
... | @@ -2,6 +2,7 @@ from flask import Flask, send_file,request,send_from_directory, render_template | ... | @@ -2,6 +2,7 @@ from flask import Flask, send_file,request,send_from_directory, render_template |
2 | import matlab.engine | 2 | import matlab.engine |
3 | from werkzeug.utils import secure_filename | 3 | from werkzeug.utils import secure_filename |
4 | import os | 4 | import os |
5 | +import time | ||
5 | import json | 6 | import json |
6 | app = Flask(__name__) | 7 | app = Flask(__name__) |
7 | 8 | ||
... | @@ -9,6 +10,16 @@ app = Flask(__name__) | ... | @@ -9,6 +10,16 @@ app = Flask(__name__) |
9 | def maiddn(): | 10 | def maiddn(): |
10 | return render_template('view.html') | 11 | return render_template('view.html') |
11 | 12 | ||
13 | +@app.route('/upload1', methods=['POST']) | ||
14 | +def upload_file1(): | ||
15 | + params = json.loads(request.get_data(), encoding='utf-8') | ||
16 | + data=params['datas'] | ||
17 | + timeData=params['timeData'] | ||
18 | + print(len(data)) | ||
19 | + print(timeData) | ||
20 | + make_wav_file(data, timeData) | ||
21 | + return send_file("out.wav", attachment_filename='test.wav', as_attachment=True) | ||
22 | + | ||
12 | @app.route('/upload', methods=['POST']) | 23 | @app.route('/upload', methods=['POST']) |
13 | def upload_file(): | 24 | def upload_file(): |
14 | params = json.loads(request.get_data(), encoding='utf-8') | 25 | params = json.loads(request.get_data(), encoding='utf-8') |
... | @@ -17,7 +28,9 @@ def upload_file(): | ... | @@ -17,7 +28,9 @@ def upload_file(): |
17 | print(len(data)) | 28 | print(len(data)) |
18 | print(timeData) | 29 | print(timeData) |
19 | make_wav_file(data, timeData) | 30 | make_wav_file(data, timeData) |
20 | - return send_file("test.wav", attachment_filename='test.wav', as_attachment=True) | 31 | + time.sleep(20) |
32 | + os.system("ffmpeg -i video.mp4 -i out.wav -c:v libx264 -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 -y ./static/output.mp4") | ||
33 | + return "Success" | ||
21 | 34 | ||
22 | 35 | ||
23 | def make_wav_file(data, timeData): | 36 | def make_wav_file(data, timeData): |
... | @@ -35,12 +48,13 @@ def make_wav_file(data, timeData): | ... | @@ -35,12 +48,13 @@ def make_wav_file(data, timeData): |
35 | l1.append(int(t)) | 48 | l1.append(int(t)) |
36 | except: | 49 | except: |
37 | print(t) | 50 | print(t) |
38 | - l2 = [n/10000 for n in l1] | 51 | + l2 = [n/4000 for n in l1] |
39 | data = matlab.double(l2) | 52 | data = matlab.double(l2) |
40 | 53 | ||
41 | filename = 'test.wav' | 54 | filename = 'test.wav' |
42 | eng.audiowrite(filename, data, hz, nargout=0) | 55 | eng.audiowrite(filename, data, hz, nargout=0) |
43 | eng.quit() | 56 | eng.quit() |
57 | + os.system("ffmpeg -i test.wav -af volume=+10dB -y out.wav") | ||
44 | 58 | ||
45 | @app.route('/combine', methods=['POST']) | 59 | @app.route('/combine', methods=['POST']) |
46 | def combineMp4Wav(): | 60 | def combineMp4Wav(): |
... | @@ -50,7 +64,7 @@ def combineMp4Wav(): | ... | @@ -50,7 +64,7 @@ def combineMp4Wav(): |
50 | return "error" | 64 | return "error" |
51 | file = request.files['Video'] | 65 | file = request.files['Video'] |
52 | file.save("video.mp4") | 66 | file.save("video.mp4") |
53 | - 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") | 67 | + # os.system("ffmpeg -i video.mp4 -i test.wav -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 -y ./static/output.mp4") |
54 | return "Success" | 68 | return "Success" |
55 | 69 | ||
56 | 70 | ... | ... |
code/out.wav
0 → 100644
No preview for this file type
code/static/output.mp4
deleted
100644 → 0
No preview for this file type
... | @@ -2,10 +2,11 @@ | ... | @@ -2,10 +2,11 @@ |
2 | <html> | 2 | <html> |
3 | <body> | 3 | <body> |
4 | <div style="text-align: center;"> | 4 | <div style="text-align: center;"> |
5 | - <video controls width="900"> | 5 | + <video controls width="300"> |
6 | <source src="{{url_for('static', filename = 'output.mp4')}}" type="video/mp4"></source> | 6 | <source src="{{url_for('static', filename = 'output.mp4')}}" type="video/mp4"></source> |
7 | 이 문장은 여러분의 브라우저가 video 태그를 지원하지 않을 때 화면에 표시됩니다! | 7 | 이 문장은 여러분의 브라우저가 video 태그를 지원하지 않을 때 화면에 표시됩니다! |
8 | </video> | 8 | </video> |
9 | + | ||
9 | </div> | 10 | </div> |
10 | </body> | 11 | </body> |
11 | </html> | 12 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
No preview for this file type
No preview for this file type
결과보고서.docx
0 → 100644
This file is too large to display.
면담확인서 및 주간보고서/12월 3주차 면담보고서.docx
0 → 100644
No preview for this file type
발표동영상.mp4
0 → 100644
This file is too large to display.
-
Please register or login to post a comment