Open djalilhebal opened 11 months ago
We may only know the filename and ext, but we can't assume its format.
Goal: Make fluent-ffmpeg
set the input filename even though it's just a stream.
[x] Use Node's URL.createObjectURL
[x] Node in-memory files? Or Node named pipes?
Apparently, Node does not support either of them natively.
[ ] Vercel supports using the FS or temp files?
Yes, seems doable.
"you can use the /tmp
folder available with serverless functions."
See How to Use Files in Serverless Functions on Vercel.
Idea: Since we are working with "real" files, why not calculate the checksum (e.g. SHA-1) of the input file and use it as ETag for the response? You know, caching and stuff.
Much ado about nothing?
The following works. This is the main logic of the API (v0.0.1): Using the subtitle file's extension as input format.
This should work
But the current approach would result in something like the following and fail:
talk-1-en is:
Content-Type: application/json; charset=utf-8
.tedcaptions
, whether the input is from the URL,1.json
, or an extensionless file.We could simply not specify the format and let ffmpeg guess its type from the input, but some malformed(?) files like sintel-fr will fail to be processed. If I understand it correctly, sintel-fr has an incorrect magic number. Specifying the filename helps ffmpeg (and VLC) recognize the file type and process it.
Maybe it's not something we should bother with?