I have an example HTML5 webpage
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function log(msg) { console.log(msg); }
$(document).ready(function() {
var video = document.getElementById("video");
video.load();
video.addEventListener('loadedmetadata', function(){
video.currentTime = 95.061728395;
});
});
</script>
<body>
<video id="video" preload="none" height="360" width="640">
<source src="news.mp4">
Your browser does not support this video.
</video>
</body>
</html>
which manually sets the currentTime property of the video tag, however it is looking for a different frame than the one I get using OpenCV / mplayer and aiming for the same time.
Using javascript, I am looking for a video at a valid time, and I am given a frame, which is usually 2 frames before the frame, which should be. I use
video.currentTime = 95.061728
in the browser and
echo -n p | mplayer -ss 95.061728395 static/news.mp4
like a team that replicates a frame. OpenCV code matches what the mplayer frame is looking for.
From mplayer video format:
Playing static / news.mp4.
libavformat version 53.21.1 (external)
Mismatching header version 53.19.0
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO: [H264] 640x360 24bpp 29.970 fps 500.4 kbps (61.1 kbyte/s)
Clip info:
major_brand: mp42
minor_version: 0
compatible_brands: isommp42
creation_time: 2011-09-27 14:41:05
Load subtitles in static
Opening video decoder: [ffmpeg] FFmpeg libavcodec codec family
libavcodec version 53.35.0 (external)
Mismatching header version 53.32.2
Selected video codec: [ffh264] vfm: ffmpeg (FFmpe`enter code here`g H.264)
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 96.0 kbit/6.80% (ratio: 12001->176400)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 640x360 => 640x360 Planar YV12
Chrome 30.0.1599.114 Linux g6 3.2.0-54-generi# 82-Ubuntu SMP
!