Git Product home page Git Product logo

Comments (2)

chenxinfeng4 avatar chenxinfeng4 commented on May 27, 2024

Try the lastest version of ffmpegcv by pip install git+https://github.com/chenxinfeng4/ffmpegcv.git. It supports more precise video-duration and average-fps.

In [1]: import ffmpegcv

# MKV file. Duration should be 283.682
In [2]: ffmpegcv.video_info.get_info_precise('2024-01-18_09-57-41_cam4.mkv')
Out[2]: VideoInfo(width=2560, height=1440, fps=25.007, count=7094, codec='hevc', duration=283.682)

In [3]: ffmpegcv.video_info.get_info('2024-01-18_09-57-41_cam4.mkv')
Out[3]: VideoInfo(width=2560, height=1440, fps=25.0, count=7094, codec='hevc', duration=283.76)


# identical file in MP4 format. Duration should be 283.682
In [4]: ffmpegcv.video_info.get_info('2024-01-18_09-57-41_cam4.mp4')
Out[4]: VideoInfo(width=2560, height=1440, fps=25.0, count=7094, codec='hevc', duration=283.682)

In [5]: ffmpegcv.video_info.get_info_precise('2024-01-18_09-57-41_cam4.mp4')
Out[5]: VideoInfo(width=2560, height=1440, fps=25.007, count=7094, codec='hevc', duration=283.682)

The ffmpegcv get_info_precise will get the precise duration by calculating the time stamp of the first and last frame WITHOUT DECODING THE STREAM.

cmd = ('ffprobe -v error -select_streams v:0 -show_entries frame=pts_time '
           f' -of default=noprint_wrappers=1:nokey=1 -read_intervals 0%+#1,99999% "{video}"')

Since the get_info_precise would take a bit more time than get_info, so the ffmpeg.VideoCapture will use get_info for general cases. Even though, the get_info_precise is much more effient than looping in opencv.

from deep-license-plate-recognition.

danleyb2 avatar danleyb2 commented on May 27, 2024

Hello @chenxinfeng4

  1. We had resolved the gray scale bug by doing an ffmpegcv upgrade
  2. For FPS we are calculating it manually by counting frames for 500ms using fps_cap.get(cv2.CAP_PROP_POS_MSEC) it works okay for RTSP too. Which i don't think reading last frame with fprobe will work

Thanks for your comments.

from deep-license-plate-recognition.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.