I have a survey that provides users the option to upload a file, with the assumption that the file will be a video. I would like to be able to automatically pull in how long the video is, but it seems like EXIF data is only available for static images. Is there any way to get this information?
I'm working on a survey where we collect sound, usually recorded in the browser using the survey123 widget. It doesn't include duration(or anything else) in the metadata. I am using ffmpeg on the backend to basically copy the audio into the identical format ("-c:a copy" flag), and ffmpeg adds the duration metadata. I then use ffprobe with flags to that produce json output containing various info about the audio file, including the duration. It's an annoying work around, but perhaps something similar would work for your video files (even just ffprobe itself might).
Short answer: on my desktop.
ffmpeg and ffprobe are executable programs installed on my system. Another program that downloads the audio submitted through survey123 runs these programs on the audio.
In my original post I was just copying the audio with ffmpeg, but in the end I decided to transcode it all to mp3 to make everything a uniform format. The specific ffmpeg and ffprobe commands I'm using are:
ffmpeg -y -i ORIGINAL.m4a -c:a mp3 NEW_FILE.mp3
ffprobe -i NEW_FILE.mp3 -v quiet -hide_banner -show_format -print_format json
The program gets the stuff from ffprobe that's usually printed to the screen, then parses the json to get the audio duration which I save in a database.