Skip to content

Question regarding the frame rate options (seems inconsistent with ffmpeg command-line) #49

@buggyyang

Description

@buggyyang

Thanks for this nice project! I have a question regarding the framerate change. For example,

import ffmpegio

with ffmpegio.open(
    "test_video.mp4",
    mode="rv",
    r=24,
    pix_fmt="rgb24",
) as videostream, ffmpegio.open(
    "low_fps.mp4",
    "wv",
    rate_in=24,
    format="mp4",
    vcodec="libx264",
    pix_fmt="yuv420p",
    overwrite=True,
) as videoout:
    for frame in videostream:
        videoout.write(frame)

I have a test_video.mp4 with 60fps, I'm trying to convert it to 24fps without changing the playback time. This means I need to drop some frames for the new framerate. Surprisingly, I find the above code seems working well. However, if I use ffmpeg -r 24 -i test_video.mp4 low_fps.mp4, the video won't drop any frame but the output video will have longer playback time. I assume the -r in ffmpegio here performs differently to ffmpeg command-line? I would be appreciated if you have any insight, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions