Skip to content

Set Framerate doesnt work :( #750

Description

@ManuLinares

Describe the bug
When exporting a tape to .mp4 and using the Set Framerate command (example Set Framerate 50), the resulting video is still encoded at 25 fps. This happens regardless of the framerate set in the tape file.

I dug into the source and it seems to be caused by two things in the ffmpeg pipeline:

  1. If you use a MarginFill color, WithMargin() creates the background using ffmpeg's lavfi color filter (color=%s:s=%dx%d). Since no rate is passed, lavfi defaults to 25 fps. Because this 25fps stream is used as the base for the overlay filter, ffmpeg forces the entire output video to match that 25fps.
  2. Even without a margin, the final ffmpeg command built in video.go is missing an explicit -r <framerate> flag right before the output file. Without it, libx264 often just falls back to 25fps anyway.

Setup

  • OS: Linux
  • Shell: bash
  • Terminal Emulator: N/A (VHS rendering)
  • Terminal Multiplexer: N/A

To Reproduce
Steps to reproduce the behavior:

  1. Create a tape file with Output demo.mp4 and Set Framerate 50 (or 60).
  2. Run vhs demo.tape.
  3. Check the framerate of the resulting video using ffprobe demo.mp4.
  4. See that the video is 25 fps instead of 50.

Source Code

Output demo.mp4
Set Framerate 50
Set Margin 20
Set MarginFill "#000000"
Type "echo hello"
Enter
Sleep 1s

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