ffmpegcv
ffmpegcv copied to clipboard
Different behavior with Opencv.
Issue:
In H264 encoded MTS files, ffmpegcv read twice frames than cv2. Other programs (including Premere Pro and Windows) report same results as cv2, not ffmpegcv.
Code
>>> import cv2
>>> import ffmpegcv
>>> capture_cv2 = cv2.VideoCapture("1-1.MTS")
>>> capture_cv2.get(cv2.CAP_PROP_FPS)
25.0
>>> capture_cv2.get(cv2.CAP_PROP_FRAME_COUNT)
15086.0
>>> capture_cv2.release()
>>> capture_ffmpegcv = ffmpegcv.VideoCapture("1-1.MTS")
>>> capture_ffmpegcv.fps
50.0
>>> capture_ffmpegcv.count
30134
>>> capture_ffmpegcv.release()
I cannot reproduct your bug. Things look all fine for me.
ffmpeg -i input.mp4 -c:v libx264 output.mts
In [1]: import ffmpegcv
In [2]: vid1 = ffmpegcv.VideoCapture('input.mp4')
In [3]: len(vid1)
Out[3]: 27026
In [4]: vid2 = ffmpegcv.VideoCapture('output.mts')
In [5]: len(vid2)
Out[5]: 27026
In [6]: for i in range(10000000):
...: ret, frame = vid1.read()
...: if ret == False:
...: break
...:
...: print('frame count', i)
frame count 27026
In [7]: for i in range(10000000):
...: ret, frame = vid2.read()
...: if ret == False:
...: break
...:
...: print('frame count', i)
frame count 27026
Can you send me a short piece of your video or link. I'll check it.
I'll send the video in about a week.