Sorry I didn’t answer you in your issue at VideoIO.jl.
I need to get the original date and time as well as duration from video files
It is actually possible, although not that pretty. But here goes…
When you open a file, you get back an
AVInput object. This contains a pointer to an
AVFormatContext (stored in an array to mimic the original C struct). The
AVFormatContext struct contains a
duration field (see here) and a
start_time_realtime field (see here).
Duration is stored in terms of
1 / AV_TIME_BASE, so you have to divide by
AV_TIME_BASE to get the time in seconds.
start_time_realtime is stored in “microseconds since the Unix epoch (00:00 1st January 1970)” (from the documentation) which is pretty standard. If this isn’t stored in the video,
start_time_realtime has the value
In code, this would look something like this:
v = VideoIO.testvideo("annie_oakley")
fc = unsafe_load(v.apFormatContext)
duration = fc.duration / VideoIO.AV_TIME_BASE
start_time_realtime = fc.start_time_realtime
no_start_time = (start_time_realtime == VideoIO.AV_NOPTS_VALUE)
println("Duration: $duration seconds")
println("Start time not available")
Duration: 24.2242 seconds
Start time not available
If you wanted to provide a better interface for this in VideoIO.jl, a PR would be very welcome!
(Also note that VideoIO.jl is broken for actually reading videos for ffmpeg versions after 3.1, although I finally figured out a fix yesterday.)