강수빈

결과보고서 및 발표동영상 업로드

......@@ -2,6 +2,7 @@ from flask import Flask, send_file,request,send_from_directory, render_template
import matlab.engine
from werkzeug.utils import secure_filename
import os
import time
import json
app = Flask(__name__)
......@@ -9,6 +10,16 @@ app = Flask(__name__)
def maiddn():
return render_template('view.html')
@app.route('/upload1', methods=['POST'])
def upload_file1():
params = json.loads(request.get_data(), encoding='utf-8')
data=params['datas']
timeData=params['timeData']
print(len(data))
print(timeData)
make_wav_file(data, timeData)
return send_file("out.wav", attachment_filename='test.wav', as_attachment=True)
@app.route('/upload', methods=['POST'])
def upload_file():
params = json.loads(request.get_data(), encoding='utf-8')
......@@ -17,7 +28,9 @@ def upload_file():
print(len(data))
print(timeData)
make_wav_file(data, timeData)
return send_file("test.wav", attachment_filename='test.wav', as_attachment=True)
time.sleep(20)
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")
return "Success"
def make_wav_file(data, timeData):
......@@ -35,12 +48,13 @@ def make_wav_file(data, timeData):
l1.append(int(t))
except:
print(t)
l2 = [n/10000 for n in l1]
l2 = [n/4000 for n in l1]
data = matlab.double(l2)
filename = 'test.wav'
eng.audiowrite(filename, data, hz, nargout=0)
eng.quit()
os.system("ffmpeg -i test.wav -af volume=+10dB -y out.wav")
@app.route('/combine', methods=['POST'])
def combineMp4Wav():
......@@ -50,7 +64,7 @@ def combineMp4Wav():
return "error"
file = request.files['Video']
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")
# 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")
return "Success"
......
No preview for this file type
No preview for this file type
......@@ -2,10 +2,11 @@
<html>
<body>
<div style="text-align: center;">
<video controls width="900">
<video controls width="300">
<source src="{{url_for('static', filename = 'output.mp4')}}" type="video/mp4"></source>
이 문장은 여러분의 브라우저가 video 태그를 지원하지 않을 때 화면에 표시됩니다!
</video>
</div>
</body>
</html>
\ No newline at end of file
......
No preview for this file type
No preview for this file type
This file is too large to display.
This file is too large to display.