I'm looking for a way to get the video duration from avi file path in Node-Webkit, one that does not involve using ffmpeg.
ffprobe.exe is a large file (30mb) and it seems a bit to much to keep it all when this is the only thing I would need it for.
I'm looking for a way to get the video duration from avi file path in Node-Webkit, one that does not involve using ffmpeg.
ffprobe.exe is a large file (30mb) and it seems a bit to much to keep it all when this is the only thing I would need it for.
Reading the video properties of a file, such as duration, bitrate, resolution, etc, requires some decoding. So, yes, you need ffmpeg.
Once you have it, you can use the HTML5 audio and video features.
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML5_audio_and_video
There is a node module : avprober which is a wrapper around the command line tool avprobe which comes bundled with install of avconv
It reveals details of given media file like Duration
... alternatively, here is some python which uses hachoir to parse media header info ... and it does handle video files (AVI,mp4, etc) to reveal Duration
import sys
from hachoir_core.cmd_line import unicodeFilename
from hachoir_core.i18n import getTerminalCharset
from hachoir_metadata import extractMetadata
from hachoir_parser import createParser
filename = sys.argv[1]
charset = getTerminalCharset()
filename, real_filename = unicodeFilename(filename, charset), filename
parser = createParser(filename, real_filename=real_filename)
metadata = extractMetadata(parser)
print("Duration (hh:mm:ss.f): %s" % metadata.get('duration'))