VideoHelp Forum
+ Reply to Thread
Results 1 to 11 of 11
Thread
  1. I have been having some issues with creating a VFR video from a sequence of images using ffmpeg.

    I have 12 PNG images and their required durations listed in a concat file as:
    Code:
    file '01.png'
    duration 0.08
    file '02.png'
    duration 0.08
    file '03.png'
    duration 0.09
    file '04.png'
    duration 0.08
    file '05.png'
    duration 0.08
    file '06.png'
    duration 0.09
    file '07.png'
    duration 0.08
    file '08.png'
    duration 0.08
    file '09.png'
    duration 0.09
    file '10.png'
    duration 0.08
    file '11.png'
    duration 0.08
    file '12.png'
    duration 0.09
    So basically the timecodes are in a 80,80,90 ms pattern.

    I use the following command to create the video:
    Code:
    ffmpeg -f concat -i list.txt -c:v libx265 -crf 24 -an out.mkv
    However, when I extract the timecodes from the video using:
    Code:
    mkvextract out.mkv timestamps_v2 0:time.txt
    I get this:
    Code:
    # timestamp format v2
    0
    80
    160
    240
    320
    400
    520
    600
    680
    760
    840
    920
    960
    As you can see the durations have been changed to:
    Code:
    80
    80
    80
    80
    80
    120
    80
    80
    80
    80
    80
    40
    Why does this happen and can it be corrected?
    Quote Quote  
  2. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    80 millisecs !! You would hardly see the image !!


    the duration format appears to be hh:mms.mmm so in your example it becomes 00:00:00.080 etc.
    Quote Quote  
  3. Both formats work. I also tested with 00:00:00.080, it gives the same result. Regarding the small duration, these are actually frames extracted from a gif.
    Quote Quote  
  4. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    But unless my maths is screwed your total run time would be little over one second.


    I suggest you try one of the online tools which will take a gif and convert it to a mp4 file


    One such tool:


    https://ezgif.com/gif-to-mp4
    Quote Quote  
  5. I did try directly converting from gif to video using:
    Code:
    ffmpeg -i in.gif -c:v libx265 -crf 24 -an out.mkv
    However, that causes ffmpeg to use a constant fps of 12
    Quote Quote  
  6. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Methinks you confuse what frame rate is. It's the number of frames played in a second - nothing to do with variable frame rate. And in your sample, which I already stated would run for one second, that is correct.


    If you want more fps then increase the numbers for the video to play longer.
    Quote Quote  
  7. You can fix the timestamps and use mkvmerge to merge them
    Quote Quote  
  8. Originally Posted by DB83 View Post
    Methinks you confuse what frame rate is. It's the number of frames played in a second - nothing to do with variable frame rate. And in your sample, which I already stated would run for one second, that is correct.


    If you want more fps then increase the numbers for the video to play longer.
    From what I understand the mkv container uses timecodes/durations (which says when and how long a frame is to be displayed) which need not be constant across all frames and as such allows one to effectively have a video with variable frame rate. Is this not correct?
    Quote Quote  
  9. Originally Posted by poisondeathray View Post
    You can fix the timestamps and use mkvmerge to merge them
    Thank you. This works. It essentially becomes a two step process where I can encode using ffmpeg using any framerate (25 fps is default) and then fix the timestamps using mkvmerge.
    Quote Quote  
  10. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    [QUOTE=mantis2892;2585105

    From what I understand the mkv container uses timecodes/durations (which says when and how long a frame is to be displayed) which need not be constant across all frames and as such allows one to effectively have a video with variable frame rate. Is this not correct?[/QUOTE]


    That is not what variable frame rate typically means.


    An encoder creates a video with some frames encoded at, for example, 15 frames per second and others, for example, at 30 frames per second. The actual encoding is variable - could NEVER apply to still images. And, again, absolutely nothing to do with how long those images play for in the video.


    No doubt you could use ffmpeg to actually encode at, in it's proper sense, variable frame rate (setting a minimum and maximum) and I would bet my shirt on when you looked at the final video you would effectively still have a constant frame rate.
    Quote Quote  
  11. Any video that has timestamps (timecodes) that has a different display time for 1 or more frames is technically VFR .

    "Display time" is how long the frame is shown, or "duration" of the frame

    eg. 30.0 FPS CFR means each frame has a display time of ~33.333 ms (because 1/30 =~ 0.033333) . If one of the frames has slightly different display time, maybe 30ms, then it's VFR
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!