Skip to content

Parsing error for Fraction FFmpeg option arguments #59

Description

@tikuma-lsuhsc

The following is a natural way to code the start & stop time (or duration) options to specify the exact frame time:

from_frame = 0
to_frame = 100
fps = ff.probe.video_streams_basic(infile)[0]["frame_rate"]
ff.transcode(
    infile,
    outfile,
    ss=from_frame / fps,
    to=to_frame / fps,
    overwrite=True,
    show_log=True,
)

The frame_rate attribute is often returned as a fraction for video (e.g., 30000/1001), resulting in ss and to values to be in fractions as well. Stringifying a Fraction object yields a string of a format: f'{numerator}/{denominator}'. This format is not understood by FFmpeg.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions