Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • F ffmpeg-python
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 402
    • Issues 402
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 34
    • Merge requests 34
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Karl Kroening
  • ffmpeg-python
  • Issues
  • #217
Closed
Open
Issue created Jun 12, 2019 by Administrator@rootContributor

How to replace a keyframe with another image

Created by: Krulvis

I'm trying to do some data moshing and I would like to be able to replace the only keyframe of a video with a custom png, such that the delta frames following the key frame affect the replaced frame. First I convert the target video using YUV420 and settings such that there will only be 1 keyframe:

process1 = (
        ffmpeg
            .input(input_video)
            .output(target_avi, r=fps, b=500000, g=fps * (end_sec - start_sec), pix_fmt='yuv420p', keyint_min=999999,
                    ss=start_sec, to=end_sec)
            .run(overwrite_output=True)
    )

However, I dont know how to replace the single left over keyframe with a custom PNG, any help is appreciated!

To be clear, I dont want to overwrite simply using .overlay(overlay_ffmpeg, eof_action='pass') as this just overlays the video with a png image, I want the video to consist of only p-frames to be able to have the inserted png be morphed by the p-frames.

Assignee
Assign to
Time tracking