[FFmpeg-user] Segment muxer list durations and video timestamps
rmanary at gmail.com
Tue Jan 7 23:09:02 CET 2014
I'm writing an application that uses an ffmpeg binary to capture live video
off a DirectShow device and write high-res archival files and low-res web
proxy videos to disk.
The front-end of the system is a web-based video editing app that needs to
be able to work with the low-res files as they are being recorded, so I'm
to map a point in the video to the file that contains that piece of video.
This works by looping through the #EXTINF lines and adding the durations
The issue I'm having is that, especially for later segments in a long
capture, the timestamp of the start of the segment does not match the one
my code has arrived at. For a three-hour recording I did yesterday, there
was a 26-second difference between the the timestamp at the start of the
final file and what my code thought it should be. Since the web app relies
on these calculated timestamps to fetch and buffer the correct segment,
seeking beyond a certain point results in the wrong segment being loaded
and if the point seeked to hadn't been incrementally buffered previously,
Here's the command my application uses:
ffmpeg -f mxf -vcodec mpeg2video -acodec pcm_s24le -i - -vf "scale=-1:360
[vid]" -map vid -map 0:a -threads 6 -flags +global_header -c:v libvpx
-deadline 1 -c:a libvorbis -b:v 1500k -b:a 64k -g 62 -f tee
For the three hour recording, my code (and Excel) arrived at 11123.11173
seconds as the starting timestamp of the last video segment but ffprobe
first audio packet:
first video frame:
And I guess for comparison, the last audio and video packets from the same
The m3u8 file says the duration of this segment is 4.138400 seconds.
Is adding durations the wrong way to go about this and should I look into
other options for producing my file index?
More information about the ffmpeg-user