Upload to static file in flask project
See original GitHub issuedef create():
if request.method == 'POST':
file = request.files["video"]
stream = ffmpeg.input(file)
stream = ffmpeg.hflip(stream)
stream = ffmpeg.output(stream, app.root_path + '/' + app.config['UPLOAD_FOLDER'] + '/videos/dd.mp4')
ffmpeg.run(stream)
-filter_complex: No such file or directory (error from ffmpeg)
Any solution for my problem? I try change directory and check directory before pass a path but error still same.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
How to serve static files in Flask - python - Stack Overflow
The simplest way is create a static folder inside the main project folder. Static folder containing .css files.
Read more >Serving Static Files with Flask - Stack Abuse
In this article we saw how you can easily serve static assets using Flask. You can serve JavaScript, CSS, images as well as...
Read more >Static Files — Flask Documentation (2.2.x)
Static Files ¶ ; static view that takes a path relative to the ; flaskr/static directory and serves it. The ; base.html template...
Read more >Flask static files (Example) - Python Tutorial
In your programs directory, create a new directory named static. In this directory you can place images, javascript files, css files and many...
Read more >Uploading files using Flask - Medium
Uploading files using Flask · $ python app.py. Then open your browser and go to localhost:5000 and you will be able to see...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t know exactly how Flask deals with POSTed files but I think it gives you a file-like object you can read from. If so, you should call ffmpeg manually (i.e.
p = subprocess.Popen(stream.compile(), stdin=subprocess.PIPE)
), use stdin as input in ffmpeg (usepipe:1
as the file name, see this), then write to the pipe with a loop, i.e. (code not tested)Check Flask’s documentation to see how to stream POST data like that.
@Honghe Did some further digging,
here’s what i’m getting:
pipe:0: Invalid data found when processing input
This is what my function looks like:
` @app.route(“/”, methods=[‘GET’, ‘POST’]) def hello_world(): print("request: ", request) print("request.files: ", request.files)
`