0

Noob question from a high school physics teacher: I have written a web app for my students to analyze videos using the HTML video player. If they take videos on their iPhones, copy them to their chromebooks, and then edit the file extension from .mov to .mp4, things work fine. Is there a way to skip the extension change? I have seen examples like this:

source src="https://www.somewebsite.com/videos/sample.mov" type="video/mp4"

where the call to the file is embedded in the code. But my students are making their own videos, so they need to be able to load them.

I tried

inputFile.type = "video/mp4"

but the type seems to be read only, because when I read it back, it is still "video/quicktime"

  • 1
    Renaming `.mov` to `.mp4` is kind of a fluke. You're not converting the file, just renaming it. Consider using `ffmpeg` to convert the videos? https://stackoverflow.com/questions/12026381/ffmpeg-converting-mov-files-to-mp4 – evolutionxbox Feb 04 '23 at 20:37
  • I agree, this is a hack. But you could just accept `video/mov` and rename it to `mp4` with a script. – Ood Feb 04 '23 at 23:23
  • @Ood I wonder why it needs to be `mp4`? If the user's computer can't play `mov`, renaming it to `mp4` won't help. – evolutionxbox Feb 04 '23 at 23:25
  • @evolutionxbox From the question it sounded to me like renaming the `mov` to `mp4` solves the playback problem for the users. Of course I can't know the specifics without more context and I wouldn't recommend doing this in any production setting. – Ood Feb 04 '23 at 23:28
  • Thanks for all the comments! I'm using my app in a classroom environment where the kids have iPhones and Chromebooks. I wanted the least-fuss route to allow them to analyze motion with their videos. While is is true that nothing I'm doing will change the file format, it is also the case that convincing Chrome that the video is an mp4 allows it to play the iPhone acquired videos. – Geoff Nunes Feb 05 '23 at 23:13

1 Answers1

1

I figured out a solution to my own question, a personal first!

var file = files[0];  // this is the quicktime file I want to read
var dummyName = file.name;
file = new File([file], dummyName, {type: "video/mp4"});

Now the variable file points to the original file, but is recognized as mp4 and can be played.