Why is VideoReader telling me the duration of every video is 0?
46 ビュー (過去 30 日間)
古いコメントを表示
I am trying to use VideoReader to gather data about a video. Ultimatly what I want to do is define a time stamp and extract the frame that corresponds to that time frame. For some reason when I use VideoReader I get all of the usual data except for the Duration which always reads 0. Ive tried a few videos and they all read 0. Below is my code.
Edit: The video im trying to load is roughly an hour long
VideoName = "video.mp4";
V = VideoReader(VideoName);
VideoHeight = V.Height;
VideoWidth = V.Width;
VideoFrames = V.NumFrames;
VideoFrameRate = V.FrameRate;
VideoLength = VideoFrames/VideoFrameRate;
TargetTimeStamp = 0;
V.CurrentTime = TargetTimeStamp;
Frame = readFrame(V);
imshow(Frame)
Here is the output of VideoReader:
Duration 0 1×1 double
Name 'video.mp4' 1×38 char
Path 'C:\Users\' 1×46 char
BitsPerPixel 24 1×1 double
FrameRate 31.4136 1×1 double
Height 1080 1×1 double
NumFrames 2328 1×1 double
VideoFormat 'RGB24' 1×5 char
Width 1920 1×1 double
Tag '' 0×0 char
UserData [ ] 0×0 double
CurrentTime 0.0318 1×1 double
6 件のコメント
Harald
2025 年 10 月 24 日 16:04
That's interesting, and I am happy for you! :)
As I wrote, it was working fine with me, and I am working on Windows. So, if you are still interested in making it work on Windows as well, please try what I suggested as an initial investigation.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Introduction to Installation and Licensing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!