question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Frame.frameDuration' is null

See original GitHub issue

New Issue Checklist

  • I have searched for a similar issue in the project and found none

Issue Info

Info Value
Device Info Redmi Note 7 Pro
System Version 10.0
APNG4Android Library Version 2.23.0
Repro rate (100%)
Repro with our demo project -
Demo project link -

Issue Description and Steps

Although the first frame is saved as file properly. But the frameCount is 0 and cannot get Frame.frameDuration for first frame at least.

I wanted to iterate through each frame but framecount is 0 so stuck here.

Exception: Attempt to read from field 'int com.github.penfeizhou.animation.decode.Frame.frameDuration' on a null object reference
WebPDecoder decoder = new WebPDecoder(new FileLoader(path),null);

  if (decoder != null){

    Bitmap bm = decoder.getFrameBitmap(0);
    // saveBitmap(bm);
    // first frame is saved succefully...

    // but here getFrameCount is 0 and invoking getFrame() causes error 
    int frameCount = decoder.getFrameCount();
    int frameDuration = decoder.getFrame(0).frameDuration;
  }        

also tried this way. But still zero frame count and null getFrame()

FrameSeqDecoder decoder = WebPDrawable.fromFile(path).getFrameSeqDecoder();
WebPDecoder decoder = WebPDrawable.fromFile(path).getFrameSeqDecoder();

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
penfeizhoucommented, Aug 9, 2022

The render listener‘s timing is precise.

0reactions
CrackerKSRcommented, Aug 13, 2022

The render listener‘s timing is precise.

Is there synchronised way. Because I can’t get Frame Bitmap and and Frame info togather. Either I will get frame count in OnStart() or get Bitmaps outside of render listener.

I tried invoking decoder.stop in OnStart like this

... 
OnStart()
  int count = decoder.getFramesCount();
  decoder.stop();
  while(i<count) {
        Bitmap bm = getFrameBitmap(i);
        i++;
  } 
... 

But this is very slow for large number of frames. Takes 1 second for each iteration

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to tell if an AVAssetTrack has a variable framerate?
I'm aware I can decode every frame and check that the frame duration doesn't change each frame but this is costly, I've had...
Read more >
Storing a position value from the previous frame - 3745574
frameDuration. an expression that would display the x position of a null in the previous frame would look like this. nl = thisComp.layer("Null...
Read more >
frameDuration Method in After Effects Expression - YouTube
Learn how to use the frame duration method and print out the frame rate, frame count and reset frames based off seconds.
Read more >
minFrameDuration | Apple Developer Documentation
A track's minimum frame duration is the reciprocal of its maximum frame rate. ... is invalid if the track can't calculate its minimum...
Read more >
How to set correct frameRate or frameDuration when writing ...
Use webm-writer-js to add frames from multiple input video tracks potentially containing different pixel dimensions. Commented lines in this.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found