intonormal / pyffmpeg

Automatically exported from code.google.com/p/pyffmpeg
1 stars 0 forks source link

get_next_frame() not in sync with video file #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
*** What steps will reproduce the problem?

======================

from pyffmpeg import *

from PIL import Image

def openVideoTest():
    #300 frames "Stefan" sequence
    # this is correctly recognized by ffmpeg 
    filename = "stefan_IP_h264jm16_2_qp30.mp4"
    TS_VIDEO_PIL={ 'video1':(CodecTypes.CODEC_TYPE_VIDEO, -1, {'outputmode':OUTPUTMODE_PIL})}

    mp=FFMpegReader()
    mp.open(filename,TS_VIDEO_PIL)

    vt=mp.get_tracks()[0]    # video track

    currFps = vt.get_fps()
    lastPts = 0
    diffPts = int(1/currFps*1e6)

    #vidim = vt.get_next_frame()
    #vidim = vt.get_next_frame()
    #vidim = vt.get_next_frame()
    for k in xrange(0,300):
        vidim = vt.get_next_frame()
        currPts = vt.get_cur_pts()
        print k, vt.get_current_frame_frameno(), currPts, "(", currPts-lastPts,")", vt.get_current_frame_pict_type()
        lastPts = currPts 

if __name__ == "__main__":
    openVideoTest()

======================

*** What is the expected output? What do you see instead?

get_next_frame() should return frame 1, 2, 3, 4, 5, 6 ... but instead 
get_next_frame() returns frame 1, 1, 1, 1, 2, 3, ...

Use the code below to reproduce the problem of missing synchronization for 
get_next_frame(). The attached video file is the Stefan sequence encoded with 
the reference codec for a QP of 30 with IPP..., so there is only one I frame at 
the beginning. get_next_frame() returns 3 or 4 frames with identical content of 
the first I frame. As the sequence has 300 frames, it should be possible to 
decode these 300 frames. Unfortunately, this is not possible and the decoding 
stops some frames before the end. 

*** What version of the product are you using? On what operating system?

Tried GIT check out from https://github.com/tranx/pyffmpeg.git and 
pyffmpeg-2.1beta.tar.gz (GIT, SVN and ZIP with different versions is quite 
confusing, so which repository is up-to-date?) 
Mac OS X
Python 2.6.6 (r266:84292, Jan  6 2011, 11:51:09) 
GCC 4.2.1 (Apple Inc. build 5664)

*** Please provide any additional information below.

Original issue reported on code.google.com by martin.h...@gmail.com on 9 Mar 2011 at 9:33

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This problem seems to be solved with the current FFmpeg version git-35d7d6f 
   http://git.ffmpeg.org/?p=ffmpeg.git;a=snapshot;h=35d7d6f7489c75aaa2fcb39820fb25b0fd44524b;sf=tgz

Find an adapted pyffmpeg version at 
  https://github.com/mhaller/pyffmpeg 

Original comment by martin.h...@gmail.com on 15 Mar 2011 at 1:25

GoogleCodeExporter commented 8 years ago

Original comment by martin.h...@gmail.com on 17 Mar 2011 at 11:27