djalilhebal / subsimplex

SubSimplex is a drop-in replacement for <track> that supports any subtitles format
https://subsimplex.vercel.app/demo/
Creative Commons Attribution 4.0 International
0 stars 0 forks source link

ffmpeg may fail if a valid subtitle file if used but the extension is set to its format #1

Open djalilhebal opened 11 months ago

djalilhebal commented 11 months ago

The following works. This is the main logic of the API (v0.0.1): Using the subtitle file's extension as input format.

ffmpeg -f srt unnamed output.vtt

This should work

# Moving forward, we will refer to this resource as talk-1-en
ffmpeg -i https://www.ted.com/talks/subtitles/id/1/lang/en output.vtt

curl -o 1.json https://www.ted.com/talks/subtitles/id/1/lang/en
ffmpeg -i 1.json output.vtt

But the current approach would result in something like the following and fail:

ffmpeg -f json -i 1.json output.vtt

talk-1-en is:


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?

djalilhebal commented 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.

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?