editly icon indicating copy to clipboard operation
editly copied to clipboard

Duration changes with FPS

Open Meldiron opened this issue 4 years ago • 7 comments

Using JSON below I tried many different renders to see how framerate changes video duration. I will try to find bug in code but I may need some help. Here are some tests:

Desired duration: 90 seconds without transition, 89 seconds with transition (2x 0.5s duration)

width (px) height(px) fps output duration (sec) output duration (with transition null)
400 400 10 88.700000 89.700000
400 400 20 88.850000 89.850000
400 400 30 88.900000 X
400 400 40 88.925000 X
400 400 50 88.940000 X
400 400 60 88.950000 89.950000
400 400 120 88.975000 X
400 400 240 88.988000 89.988000
------------ ------------ ----- ----------------------- -----------------
800 800 10 88.700000 X
1920 1080 10 88.700000 X

(X means "no test")

JSON:

{ 
  "width": 1920, "height": 1080, "fps": 10,
  "outPath": "./subtitle.mp4",
  "defaults": {
    "layer": { "fontPath": "./Montserrat-Bold.ttf" },
    "transition": { "name": "fade" },
  },
  "clips": [
    { "duration": 30, "layers": [
       {
          "type": "subtitle",
          "text": "ST1 "
        },
         {
          "type": "title",
          "text": "T1 "
        }
    ] },
    { "duration": 30, "layers": [
       {
          "type": "subtitle",
          "text": "ST2 "
        },
         {
          "type": "title",
          "text": "T2 "
        }
    ] },
    { "duration": 30, "layers": [
       {
          "type": "subtitle",
          "text": "ST3 "
        },
         {
          "type": "title",
          "text": "T3 "
        }
    ] },
  ],
}

Meldiron avatar May 30 '20 09:05 Meldiron

Yeah, I think there is a small bug where it drops a frame some times. Will look into it when I have more time

mifi avatar May 31 '20 13:05 mifi

@mifi Can confirm when using fps: 60

ghost avatar Jul 23 '20 14:07 ghost

Can also confirm when using fps: 15 and fps: 30 on my videos -> expected duration 18:17 -> output duration 18:15

timosg avatar Jul 23 '20 15:07 timosg

@mifi I have two videos, both are 1.5 seconds, 60 fps. I do a 3-second transition so it should be as flush 3-sec output. Instead, the output is 2.21667s. When I change the FPS to 15, the output becomes 2.2s.

Edit: My understanding of how transitions work was wrong, the output should be 1.5 seconds, as the transition happens while both videos are playing. I was thinking in terms of addition due to the fact I was working with images.

It's causing my video and audio to be out of sync in proportion to the number of transitions. I tried commenting out the pts factor and scaling stuff in videoFrameSource.js and it made no difference though.

ghost avatar Jul 23 '20 16:07 ghost

@TimoGruber For now I am using ffmpeg-gl-transitions since gl transitions were the only component of editly I was using

ghost avatar Jul 24 '20 03:07 ghost

Can you try again in 0.5.0?

mifi avatar Sep 06 '20 19:09 mifi

For me there is still a slight difference on the output file (about 1 sec). But with the keepSourceAudio option there is obviously no need for creating a external audio file from the sources and sync it with the video.

timosg avatar Sep 28 '20 14:09 timosg