Closed ghost closed 1 year ago
I could not see a way to access the total frames present in the file.
@avadhut-00 It is in docs, you can easily access number of frames using the approx_video_nframes
parameter in metadata: https://abhitronix.github.io/deffcode/latest/recipes/basic/extract-video-metadata/#extracting-video-metadata-using-sourcer-api
# import the necessary packages
from deffcode import Sourcer
# initialize and formulate the decoder using suitable source
sourcer = Sourcer("foo.mp4").probe_stream()
# print `approx_video_nframes` metadata
print(sourcer.retrieve_metadata()["approx_video_nframes"])
I have access to fps
Similarily for FPS you can see source_video_framerate
parameter in metadata:
# import the necessary packages
from deffcode import Sourcer
# initialize and formulate the decoder using suitable source
sourcer = Sourcer("foo.mp4").probe_stream()
# print `source_video_framerate` metadata
print(sourcer.retrieve_metadata()["source_video_framerate"])
The solution provided works correctly for tracking progress( via tqdm library ) for reading video files
Issue guidelines
Issue Checklist
Describe your Question
Hi DeffCode Team, In the Basic Recipes --->Decoding Video Files Code ,I want to able to see a progress bar while the file was being read but I could not see a way to access the total frames present in the file. I usually use tqdm library to enable progress bars for reading/writing video. For me to implement a manual progress bar in tqdm I need to know the total frames present. In OpenCV I have access to fps and frame count using the code-block given below
Could you please point me to a way to achieve the same using deffcode API
Terminal log output(Optional)
No response
Python Code(Optional)
No response
DeFFcode Version
0.2.5
Python version
3.9.16
Operating System version
Linux
Any other Relevant Information?
No response