[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Aviread not reading frames correctly from video, repeates key frames

From: pecenastruca
Subject: Aviread not reading frames correctly from video, repeates key frames
Date: Sat, 5 Jan 2019 06:22:32 -0600 (CST)

The problems:

I have a .mp4 video, trying to read it. What I get as an end result are
repeating key frames. I tested the same setup in a virtualbox machine,
installed Ubuntu 18.04, required dependencies for the video package and the
same input file, which worked.

The other problem:

It seems to fail reading the file at position 471 and every position after.
The video has 600 frames in total.
>> aviread("dge.mp4",471)
AVHandler: Error reading packet after timestamp 0
error: aviread: cannot read frame 471


So if the video has 30 frames per second and a key frame is every 1 second,
that means that there are going to be 30 duplicate frames in a 1 second

Link to the video file:

What I tried so far:

I am using octave 4.2.2. I tried reinstalling and building from source, same
results. I am running Xubuntu 16.04. The versions of libavutil-dev
libavformat-dev libswscale-dev libavcodec-dev were all on versions 
7:2.8.15. I then removed them and replaced them with a newer, backported
version of FFMPEG-4 from here. 

I have run out of ideas what to try. It seems that the problem lies
somewhere inbetween Octave and the libraries. The libraries seem fine and
Octave works well too. 

The code:
pkg load video
pkg load image
info = aviinfo (video)

for i = 1:info.NumFrames-1
  string = int2str(i)
  concated = strcat("img",string,".jpeg")
  img = aviread(video,i);
  imwrite(img, concated)                  
Output of aviinfo:

info =

  scalar structure containing the fields:

    Filename = dge.mp4
    FileSize =  18238587
    FileModDate = 04-Aug-2018 19:51:46
    NumFrames =  600
    FramesPerSecond =  29.934
    Width =  1920
    Height =  1080
    ImageType = truecolor
    VideoCompression = h264
    Quality =  100
    NumColormapEntries = 0
    AudioFormat = aac
    AudioRate =  48000
    NumAudioChannels =  2
    Title =
    Author =
    Comment =
The folder with the images:

Sent from:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]